doomer/config/config.go

42 lines
814 B
Go
Raw Permalink Normal View History

2022-12-06 00:57:09 +03:00
package config
import "flag"
type Config struct {
Save bool
Host string
Url string
Telegram TelegramConfig
}
type TelegramConfig struct {
Token string
LogChatID int64
}
var conf Config
func InitConfig() *Config {
save := flag.Bool("save", false, "Save passed arguments to storage")
2022-12-07 11:20:50 +03:00
host := flag.String("host", "", "Web server host ip:port")
2022-12-06 00:57:09 +03:00
url := flag.String("url", "https://doom.nefrace.ru/", "Base URL of web api")
token := flag.String("tlgtoken", "", "Telegram Bot API Token")
logChat := flag.Int64("tlglog", -1001688182314, "Telegram log chat for caching images")
flag.Parse()
conf = Config{
Save: *save,
Host: *host,
Url: *url,
Telegram: TelegramConfig{
Token: *token,
LogChatID: *logChat,
},
}
return &conf
}
func Conf() *Config {
return &conf
}