Blog

ColdBox Free Tip 1: Environment Variables In The Config

Victor Campos August 25, 2025

Spread the word

Victor Campos

August 25, 2025

Spread the word


Share your thoughts

1/10 FREE ColdBox Tips and Tricks - Book: 102 ColdBox Tips and Tricks!

Welcome to the first of 10 FREE tips and tricks in our "102 ColdBox Tips and Tricks" Book! In this post, we’ll show you how to easily access system environment variables within your ColdBox configuration files, making your app setup smoother and more flexible!

More Tips and Tricks

Using getSystemSetting() Method!

When working within a ColdBox.cfc or a ModuleConfig.cfc, you can leverage the getSystemSetting() method to retrieve system environment variables. Here’s how it works:

appName = getSystemSetting( "APPNAME", "ContentBox Modular CMS" )
tier = getSystemSetting( "ENVIRONMENT", "PRODUCTION" )
  • First Parameter: Name of the environment variable.
  • Second Parameter: A default value, in case the variable is not found.
  • Please note that all environment variables are strings

ColdBox Book

Order of Lookup

The getSystemSetting() method follows a specific order when looking for the environment variable:

  1. Java system properties
  2. System environment variables

Need a Specific Value?

  • If you only need a Java system property, use the getSystemProperty() method.
  • If you only need a system environment variable, use the getEnv() method.

Using these methods, you can manage your environment configurations more efficiently, ensuring that your ColdBox applications are always correctly set up across different environments.

.env Convention

If you are running your ColdBox applications with CommandBox, you have the extra benefit of having an .env file in the root of your application. CommandBox will read it and seed it into the engine for you upon startup so you can use those as environment variables. Here is a sample .env file:

# ColdBox Name and Environment
APPNAME=ColdBox
ENVIRONMENT=development

# Database Information
DB_CONNECTIONSTRING=jdbc:mysql: //127.0.0.1:3306/coldbox?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useLegacyDatetimeCode=true&allowPublicKeyRetrieval=true
DB_CLASS=com.mysql.jdbc.Driver
DB_BUNDLENAME=com.mysql.cj
DB_BUNDLEVERSION=8.0.30
DB_DRIVER=MySQL
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=coldbox
DB_USER=root
DB_PASSWORD=

# JWT Information
JWT_SECRET=

# S3 Information
S3_ACCESS_KEY=
S3_SECRET_KEY=
S3_REGION=us-east-1
S3_DOMAIN=amazonaws.com

Learn More ColdBox Tips and Tricks

Stay tuned for more ColdBox tips in our ongoing series. if you want to learn more than 10 free tips and tricks make sure to get your “ColdBox 102 tips and tricks book” We have a variety of formats you can choose from.

Get your Copy

Join the Ortus Community

Be part of the movement shaping the future of web development. Stay connected and receive the latest updates on**, product launches, tool updates, promo services and much more.**

Subscribe to our newsletter for exclusive content.

Follow Us on Social media and don’t miss any news and updates:

Add Your Comment

Recent Entries

How to Modernize Legacy Applications with a Fixed Monthly Budget (Without a Big Rewrite)

How to Modernize Legacy Applications with a Fixed Monthly Budget (Without a Big Rewrite)

Many organizations know they need to modernize their legacy applications.

They see the risks.

They feel the operational pressure.

They understand the long-term impact.

But the initiative never starts.

Not because the problem is unclear.

Because the budget is.


The Real Problem Is Not Technology. It’s Budgeting.

In many organizations, especially in enterprise or public sector environments, modernization competes with multiple prio...

Cristobal Escobar
Cristobal Escobar
March 25, 2026
From Monolith to Modular: Modernizing ColdFusion Architecture Without Breaking Production

From Monolith to Modular: Modernizing ColdFusion Architecture Without Breaking Production

Most ColdFusion systems don’t fail because of traffic

Most ColdFusion applications don’t break under load.

They break under change.

A small update triggers unexpected side effects.

A deployment introduces instability.

A simple feature takes weeks because no one wants to touch certain parts of the codebase.

This isn’t a performance problem.

It’s an architecture problem.

And in many mature CFML environme...

Cristobal Escobar
Cristobal Escobar
March 24, 2026
Into the Box 2026 Goes Virtual: Watch on Demand From Anywhere! 🌎

Into the Box 2026 Goes Virtual: Watch on Demand From Anywhere! 🌎

Not everyone can make it on-site and that’s exactly why Into the Box 2026 Virtual Edition exists.

This year, we’re bringing the full conference days experience online, so you can tap into the same insights, sessions, and innovation no matter where you are in the world.

Maria Jose Herrera
Maria Jose Herrera
March 23, 2026