configImport

Imports a configuration based on the CFConfig format.

configImport(path path, [, type] [, password], [, params], [, charset]) → returns struct

This function requires Lucee 5.3.8 and up.  Not supported on Adobe ColdFusion, etc.

Argument Reference

path any
Required
Default: false

Path to the .CFConfig.json file or the data itself as a Struct.

type string
Default: server

Config Context to manipulate, server or web context.
Values:
  • web
  • server

password string
Default: false

password to access the configuration, depending on the value set for the attribute type.

params struct
Default: false

placeholder parameters to use as actual data for the placeholders inside the configuration.

charset string
Default: false

charset to use to read the .CFConfig file, if not defined, Lucee will use the default resource charset.

Compatibility

Lucee:

Version 5.3.8+ Added in 5.3.8.207

Examples
Sample code invoking the configImport function

Imports a configuration based on the CFConfig format from a file using a password stored in an environment variable.

configImport(
	path: expandPath('/config/config.json'),
	type: 'server',
	password: SERVER.system.environment.PASSWORD
);

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub