add debug command for environment. add docker up/down to Makefile

This commit is contained in:
lyx0 2023-12-08 19:23:31 +01:00
parent f67b267933
commit 05d49e9577
3 changed files with 12 additions and 0 deletions

View file

@ -28,6 +28,12 @@ build:
run:
./bin/${BINARY_NAME} -env="prod"
up:
docker compose up
down:
docker compose down
prod:
cd cmd/nourybot && go build -o ${BINARY_NAME}
mv cmd/nourybot/${BINARY_NAME} ./bin/${BINARY_NAME}

View file

@ -200,6 +200,10 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
if userLevel >= 100 {
app.DebugCommand(cmdParams[2], message)
}
case "env":
if userLevel >= 100 {
reply = app.Environment
}
}
// --------------------------------

View file

@ -41,6 +41,7 @@ type application struct {
Db *sql.DB
Models data.Models
Scheduler *cron.Cron
Environment string
// Rdb *redis.Client
}
@ -122,6 +123,7 @@ func main() {
Db: db,
Models: data.NewModels(db),
Scheduler: cron.New(),
Environment: cfg.env,
}
app.Log.Infow("db.Stats",