build(docker): support of force command registration
This commit is contained in:
parent
31930986fb
commit
ad129e8ae4
5 changed files with 12 additions and 8 deletions
|
@ -9,3 +9,4 @@ POSTGRES_DB=les-copaings
|
||||||
# Bot #
|
# Bot #
|
||||||
##############
|
##############
|
||||||
TOKEN=your_token
|
TOKEN=your_token
|
||||||
|
FORCE_COMMAND_REGISTRATION=false # force registration of command
|
||||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -24,4 +24,5 @@ go.work
|
||||||
.idea
|
.idea
|
||||||
.env
|
.env
|
||||||
tmp
|
tmp
|
||||||
|
config/**.toml
|
||||||
|
data
|
||||||
|
|
|
@ -10,4 +10,6 @@ RUN go mod tidy && go build -o app .
|
||||||
|
|
||||||
ENV TOKEN=""
|
ENV TOKEN=""
|
||||||
|
|
||||||
CMD ./app -token $TOKEN
|
ENV FORCE_COMMAND_REGISTRATION="false"
|
||||||
|
|
||||||
|
CMD ./app -token $TOKEN -forge-command-registration $FORCE_COMMAND_REGISTRATION
|
||||||
|
|
|
@ -4,7 +4,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- ./tmp:/app/config
|
- ./config:/app/config
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- postgres
|
- postgres
|
||||||
|
|
8
main.go
8
main.go
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
token string
|
token string
|
||||||
forgeCmdRegistering bool
|
forceCmdRegistration bool
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -23,8 +23,8 @@ const (
|
||||||
func init() {
|
func init() {
|
||||||
flag.StringVar(&token, "token", "", "token of the bot")
|
flag.StringVar(&token, "token", "", "token of the bot")
|
||||||
flag.BoolVar(
|
flag.BoolVar(
|
||||||
&forgeCmdRegistering,
|
&forceCmdRegistration,
|
||||||
"forge-command-registering",
|
"forge-command-registration",
|
||||||
false,
|
false,
|
||||||
"force the registration of command",
|
"force the registration of command",
|
||||||
)
|
)
|
||||||
|
@ -164,7 +164,7 @@ func main() {
|
||||||
},
|
},
|
||||||
AfterInit: afterInit,
|
AfterInit: afterInit,
|
||||||
}
|
}
|
||||||
bot.Start(forgeCmdRegistering)
|
bot.Start(forceCmdRegistration)
|
||||||
|
|
||||||
xp.CloseRedisClient()
|
xp.CloseRedisClient()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue