Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dynamic bot configuration. #13

Open
mayberryrfd opened this issue Feb 11, 2018 · 2 comments
Open

Implement dynamic bot configuration. #13

mayberryrfd opened this issue Feb 11, 2018 · 2 comments
Labels
decision needed enhancement New feature or request help wanted Extra attention is needed post-1.0

Comments

@mayberryrfd
Copy link
Contributor

mayberryrfd commented Feb 11, 2018

Values like TEAM_SIZE, TEAM_COUNT and so on are currently set via environment variables, stored in .env. This is not the way I want to handle this going forward. Ideally, the bot should support dynamic configuration commands like ~set team_size 4 and ~set game_title overwatch and so forth.

One possible way to do this is via config files:

  • config-rs: Supports multiple file formats, as well as hierarchical configuration
  • toml-rs: Basically the serde_json of TOML format. Would involve a lot rolling our own implementation.

Another way would be to store default per-title (e.g. Overwatch, LawBreakers, etc.) configuration information in the database and load them that way, and support mutating those values via the aforementioned commands. For example, there'd be a table like

create table game (
  game_id serial primary key,
  title varchar,
);

create table game_config (
  game_config_id serial primary key,
  game_id integer references game,
  team_size int,
  team_count int,
);

from which the bot would read. Those values would get stored to like a Config struct. Then the hypothetical set serenity command would mutate those values based on the args to set. (Obviously there'd have to be some permissions-checking of the command-sender to avoid trouble-making.)

@mayberryrfd
Copy link
Contributor Author

This is marked as post-1.0 just to indicate it's not something I will work on before the 1.0 release, but if a contributor wants to dive in on it, go ahead.

@Arzte
Copy link

Arzte commented Feb 11, 2018

config-rs is nice because it doesn't tie you down to any format, so if something doesn't work as well as you'd hope, you can just switch. You can also do combo config files made up of different types if per say you wanted to store some data in json, and config variables in toml.

@mayberryrfd mayberryrfd added the help wanted Extra attention is needed label Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision needed enhancement New feature or request help wanted Extra attention is needed post-1.0
Projects
None yet
Development

No branches or pull requests

2 participants