4 ms·
Same here... just using the same language as the rest application, usually a file with constants or a class/struct/module/whatever. the only reason config file
by tobyhinloopen 8y ago
Same here... just using the same language as the rest application, usually a file with constants or a class/struct/module/whatever.
the only reason config files in another language might be required is when you require configuring the application after it is compiled to native binary code.
Obviously this doesn't apply to all these applications written in scripting languages.
I do wonder how you create type-safe config files though. I currently have a `development.ts` and a `production.ts`, where the `production.ts` is only loaded when `node_env === production`. `production.ts` contains blank/default values and the file is overwritten on the server with production secrets.
- shusson 8y ago> I do wonder how you create type-safe config files though The types help prevent erroneous config declarations. e.g ``` enum LogLevel { Info = "info", Debug = "debug" } const MyConfig = { logOptions: { level: LogLevel.Debug } }; ``` And since we serialise `MyConfig`, the config has to be transpiled by Typescript.