change the command prefix based on the environment.

if running in the `prod` environment continue using the `()` prefix. otherwise in `dev` environment use !! as the prefix so we don't interfere with database calls to the production database because it was the same commands in both environments.
This commit is contained in:
lyx0 2023-12-17 22:53:23 +01:00
parent 98962a98b7
commit c4a05a2619

View file

@ -74,7 +74,6 @@ func main() {
cfg.twitchClientId = os.Getenv("TWITCH_CLIENT_ID") cfg.twitchClientId = os.Getenv("TWITCH_CLIENT_ID")
cfg.twitchClientSecret = os.Getenv("TWITCH_CLIENT_SECRET") cfg.twitchClientSecret = os.Getenv("TWITCH_CLIENT_SECRET")
cfg.wolframAlphaAppID = os.Getenv("WOLFRAMALPHA_APP_ID") cfg.wolframAlphaAppID = os.Getenv("WOLFRAMALPHA_APP_ID")
cfg.commandPrefix = os.Getenv("TWITCH_COMMAND_PREFIX")
cfg.twitchID = os.Getenv("TWITCH_ID") cfg.twitchID = os.Getenv("TWITCH_ID")
cfg.env = os.Getenv("ENV") cfg.env = os.Getenv("ENV")
tc := twitch.NewClient(cfg.twitchUsername, cfg.twitchOauth) tc := twitch.NewClient(cfg.twitchUsername, cfg.twitchOauth)
@ -82,8 +81,10 @@ func main() {
switch cfg.env { switch cfg.env {
case "dev": case "dev":
cfg.db.dsn = os.Getenv("DEV_DSN") cfg.db.dsn = os.Getenv("DEV_DSN")
cfg.commandPrefix = "!!"
case "prod": case "prod":
cfg.db.dsn = os.Getenv("PROD_DSN") cfg.db.dsn = os.Getenv("PROD_DSN")
cfg.commandPrefix = "()"
} }
// Database config variables // Database config variables
cfg.db.maxOpenConns = 25 cfg.db.maxOpenConns = 25