knights-of-academia / horace

discord.js bot powering the Knights of Academia server with commands like info, AFK, and more
MIT License
23 stars 19 forks source link

Separate environment and config variables #253

Closed debashisbiswas closed 3 years ago

debashisbiswas commented 3 years ago

Currently, we only have a config.json file that has both environment variables and config variables. These two types of variables should be separated.

Environment variables are variables that change depending on the environment the code is running in, and secrets that can't be checked into the repo. One example of this is channel IDs. Config variables are those that can be configured but do not need to change depending on the environment. For example, the color koaYellow in our config file will stay the same across all instances of the bot. If we end up changing it, we'll change it for the codebase in general, rather than for one particular environment. These do not need to be in a .example file.

By separating these, everything that will need to be changed when someone clones the repo will all be in one file. This also allows us to change config variables with commits to the repo, rather than needing to update them manually on the production server's copied .example file. Additionally, the .example file will change less often, making it easier to keep copied .example files in sync with their counterparts.