aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-27 18:36:42 +0200
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-27 18:36:42 +0200
commitad129e8ae47fd9cd151115b6f5b84e7eae979d6d (patch)
treee2326d28314a923bff1e2a3ed3d30c50f66ba81f
parent31930986fbff968d8517da0187c0de65d85ab79f (diff)
build(docker): support of force command registration
-rw-r--r--.env.example1
-rw-r--r--.gitignore3
-rw-r--r--Dockerfile4
-rw-r--r--docker-compose.yml2
-rw-r--r--main.go10
5 files changed, 12 insertions, 8 deletions
diff --git a/.env.example b/.env.example
index cd13f27..a98e8bb 100644
--- a/.env.example
+++ b/.env.example
@@ -9,3 +9,4 @@ POSTGRES_DB=les-copaings
# Bot #
##############
TOKEN=your_token
+FORCE_COMMAND_REGISTRATION=false # force registration of command
diff --git a/.gitignore b/.gitignore
index 7972181..7cc06cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,4 +24,5 @@ go.work
.idea
.env
tmp
-
+config/**.toml
+data
diff --git a/Dockerfile b/Dockerfile
index b56e430..59103c4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,4 +10,6 @@ RUN go mod tidy && go build -o app .
ENV TOKEN=""
-CMD ./app -token $TOKEN
+ENV FORCE_COMMAND_REGISTRATION="false"
+
+CMD ./app -token $TOKEN -forge-command-registration $FORCE_COMMAND_REGISTRATION
diff --git a/docker-compose.yml b/docker-compose.yml
index ba5c537..974a273 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,7 +4,7 @@ services:
env_file:
- .env
volumes:
- - ./tmp:/app/config
+ - ./config:/app/config
depends_on:
- redis
- postgres
diff --git a/main.go b/main.go
index a33fe30..9964269 100644
--- a/main.go
+++ b/main.go
@@ -12,8 +12,8 @@ import (
)
var (
- token string
- forgeCmdRegistering bool
+ token string
+ forceCmdRegistration bool
)
const (
@@ -23,8 +23,8 @@ const (
func init() {
flag.StringVar(&token, "token", "", "token of the bot")
flag.BoolVar(
- &forgeCmdRegistering,
- "forge-command-registering",
+ &forceCmdRegistration,
+ "forge-command-registration",
false,
"force the registration of command",
)
@@ -164,7 +164,7 @@ func main() {
},
AfterInit: afterInit,
}
- bot.Start(forgeCmdRegistering)
+ bot.Start(forceCmdRegistration)
xp.CloseRedisClient()
}