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") host := flag.String("host", "", "Web server host ip:port") 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 }