remove env
This commit is contained in:
parent
180baa1bb2
commit
f85da9b418
@ -20,4 +20,4 @@ WORKDIR /app/
|
||||
COPY --from=builder /app/gottdad .
|
||||
|
||||
# Command to run the executable
|
||||
CMD ["./gottdad"]
|
||||
CMD ["./gottdad -config /app/data/config.json"]
|
1
go.mod
1
go.mod
@ -3,7 +3,6 @@ module git.siteop.biz/shoopea/gottdad
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133
|
||||
github.com/tidwall/pretty v1.2.0
|
||||
gopkg.in/tucnak/telebot.v2 v2.4.0
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -1,7 +1,5 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133 h1:h6FO/Da7rdYqJbRYMW9f+SMBWnJVguWh+0ERefW8zp8=
|
||||
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133/go.mod h1:pyYc5lldRtL0l5YitYVv1dLKuC0qhMfAfiR7BLsN2pA=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
27
main.go
27
main.go
@ -5,20 +5,15 @@ import (
|
||||
"time"
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/ianschenck/envflag"
|
||||
)
|
||||
|
||||
var (
|
||||
cfg *Config
|
||||
srv *ServerTTD
|
||||
bot *Bot
|
||||
configFile string
|
||||
cfg *Config
|
||||
srv *ServerTTD
|
||||
bot *Bot
|
||||
|
||||
configFlag = flag.String("config", "", "config file")
|
||||
configFlag = flag.String("config", "config.json", "config file")
|
||||
initFlag = flag.Bool("init", false, "init config")
|
||||
configEnv = envflag.String("CONFIG", "", "config file")
|
||||
initEnv = envflag.Bool("INIT", false, "init config")
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -26,23 +21,15 @@ func main() {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if *configFlag != "" {
|
||||
configFile = *configFlag
|
||||
} else if *configEnv != "" {
|
||||
configFile = *configEnv
|
||||
} else {
|
||||
configFile = "config.json"
|
||||
}
|
||||
|
||||
cfg = &Config{}
|
||||
if *initFlag || *initEnv {
|
||||
if *initFlag {
|
||||
logInfoWarn("Initializing configuration..")
|
||||
err = cfg.Init()
|
||||
failError(err, "Cannot init config")
|
||||
err = cfg.Save(configFile)
|
||||
err = cfg.Save(*configFlag)
|
||||
failError(err, "Cannot save config")
|
||||
} else {
|
||||
err = cfg.Load(configFile)
|
||||
err = cfg.Load(*configFlag)
|
||||
failError(err, "Cannot open config")
|
||||
}
|
||||
|
||||
|
2
ttd.go
2
ttd.go
@ -143,7 +143,7 @@ func (s *ServerTTD) HeartBeat(stop chan struct{}) {
|
||||
} else if s.Status.Paused && !s.NeedPause() {
|
||||
s.Unpause()
|
||||
}
|
||||
cfg.Save(configFile)
|
||||
cfg.Save(*configFlag)
|
||||
time.Sleep(updateHeartBeat)
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by version.sh (@generated) DO NOT EDIT.
|
||||
package main
|
||||
var githash = "1fba5c6"
|
||||
var buildstamp = "2021-11-06_16:13:18"
|
||||
var commits = "158"
|
||||
var version = "1fba5c6-b158 - 2021-11-06_16:13:18"
|
||||
var githash = "180baa1"
|
||||
var buildstamp = "2021-11-06_16:24:55"
|
||||
var commits = "161"
|
||||
var version = "180baa1-b161 - 2021-11-06_16:24:55"
|
||||
|
Loading…
Reference in New Issue
Block a user