lewster32 / corporallancot

A Discord bot primarily for recording, searching and retrieving notes and quotes
MIT License
1 stars 2 forks source link

Separate config into individual structs for each configurable component/service #18

Closed lewster32 closed 4 years ago

lewster32 commented 4 years ago

Currently the config file represents a flat list of key/value pairs, however now that config for each component/service has been abstracted away into individual classes, we can make this cleaner and specify individual structs for each configurable component/service. This would change the config from something like this:

{
  "key": "<DISCORD_BOT_TOKEN>",
  "db": "notes",
  "dbTable": "notes",
   ...
}

... to something like this:

{
  "discord": {
    "key": "<DISCORD_BOT_TOKEN>"
  },
  "database": {
    "db": "notes",
    "table": "notes",
    ...
  }
}
Bidthedog commented 4 years ago

This task affects how #3 will be implemented - we need to move the sensitive info out of config.json and into the docker .env file, then inject that info into the app with an environment variable (fairly simple, we do this with the bot name / description atm).

Bidthedog commented 4 years ago

I'd say this isn't closed just yet - we still need to create the classes and improve the appConfig function - which I think is likely to change into a class with methods for each config section (so the functions can be injected into each class that needs them). Just wanted to get the CI stuff in there with minimal mods for now.