{"record":{"id":"d792066c1b6a1bf0","repo":"MagicMirrorOrg/MagicMirror","slug":"config-js-template-files-are-deprecated-and-not-us","errorCode":null,"errorMessage":"config.js.template files are deprecated and not used anymore. You can use variables inside config.js so copy the template file content into config.js if needed.","messagePattern":"config\\.js\\.template files are deprecated and not used anymore\\. You can use variables inside config\\.js so copy the template file content into config\\.js if needed\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"js/utils.js","lineNumber":118,"sourceCode":" * @returns {object} an object holding full and redacted config\n */\nconst loadConfig = () => {\n\tLog.log(\"Loading config ...\");\n\tconst defaults = require(\"./defaults\");\n\tif (global.mmTestMode) {\n\t\t// if we are running in test mode\n\t\tdefaults.address = \"0.0.0.0\";\n\t}\n\n\t// For this check proposed to TestSuite\n\t// https://forum.magicmirror.builders/topic/1456/test-suite-for-magicmirror/8\n\tconst configFilename = getConfigFilePath();\n\tlet templateFile = `${configFilename}.template`;\n\n\t// check if templateFile exists\n\ttry {\n\t\tfs.accessSync(templateFile, fs.constants.F_OK);\n\t\tLog.warn(\"config.js.template files are deprecated and not used anymore. You can use variables inside config.js so copy the template file content into config.js if needed.\");\n\t} catch {\n\t\t// no action\n\t}\n\n\t// check if config.env exists\n\tconst configEnvFile = `${configFilename.substr(0, configFilename.lastIndexOf(\".\"))}.env`;\n\ttry {\n\t\tif (fs.existsSync(configEnvFile)) {\n\t\t\t// load content into process.env\n\t\t\tloadEnvFile(configEnvFile);\n\t\t}\n\t} catch (error) {\n\t\tLog.log(`${configEnvFile} does not exist. ${error.message}`);\n\t}\n\n\t// Load config.js and catch errors if not accessible\n\ttry {\n\t\tlet configContent = fs.readFileSync(configFilename, \"utf-8\");","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/js/utils.js#L100-L136","documentation":"loadConfig checks whether a config.js.template file exists next to config.js. MagicMirror no longer processes template files; if one is found, it warns that templates are dead and that environment-variable substitution should be done directly inside config.js (config.js is executed as JS, so variables work natively).","triggerScenarios":"A leftover config.js.template file sits in the config directory (often from old Docker setups that previously consumed it) while checkConfigFile/loadConfig runs at startup.","commonSituations":"Migrating from an old docker container or install scripts that generated config.js.template; following an outdated tutorial that instructs creating a .template file.","solutions":["Delete or rename the config.js.template file.","If you need env-var substitution, put it directly in config.js, e.g. use process.env.MY_VAR inside the config JavaScript.","Use the supported config.env file (loaded alongside config.js) if environment-based configuration is desired."],"exampleFix":"// before: config.js.template contains ${MM_PORT}\n// after: delete config.js.template and in config.js write\nvar config = { port: process.env.MM_PORT || 8080 };","handlingStrategy":"validation","validationCode":"# ensure no template file lingers before starting:\nls config/config.js* # remove config.js.template if present\nrm -f config/config.js.template","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete stale .template files from old installs/Docker images","Do env-var substitution directly in config.js (it is plain JavaScript)","Use the supported config.env mechanism instead of templates","Exclude *.template from deployment scripts"],"tags":["config","deprecation","template"],"backgroundTag":"deprecated-config-template-file","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}