Skip to content

sjdaniels/coldbox-module-dotenvsettings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ColdBox DotEnvSettings Module

This module reads a .env (or other file containing secrets) and loads the values into the parent app's ColdBox settings. Based on Eric Peterson's CommandBox Module.

LICENSE

Apache License, Version 2.0.

SYSTEM REQUIREMENTS

  • Railo/Lucee 4+
  • ColdFusion 9+
  • ColdBox 4+

Instructions

Just drop into your modules folder or use the box-cli to install

box install dotenvsettings

USAGE

Create a .env file in your project root and add to .gitignore or your version control's equivalent (don't commit secrets to your repo!) The file can contain JSON or Java properties style key value pairs:

// property style
MY_SECRET_KEY=somevalue
MY_OTHER_SECRET=shh

// json style
{
     "MY_SECRET_KEY"="somevalue"
    ,"MY_OTHER_SECRET"="shh"
};

In your ColdBox app you can access these with getSetting("MY_SECRET_KEY") or DI with property name="mykey" inject="coldbox:setting:MY_SECRET_KEY";

If you want to customize your secrets file name / location just add the following struct to your Coldbox.cfc config() method:

dotenv = {
    fileName = "config/secrets.json"
}

About

Add secrets from .env or json config to ColdBox settings.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published