diff --git a/web/conf/conf.go b/web/conf/conf.go new file mode 100644 index 0000000..a9b489d --- /dev/null +++ b/web/conf/conf.go @@ -0,0 +1,24 @@ +package conf + +import ( + "os" + + "gopkg.in/yaml.v3" +) + +const CONF_FILE = "/etc/skazanull/web.conf.yml" + +type Conf struct { + DBConfig string `yaml:"db_config"` + Interface string `yaml:"interface"` + EncryptionKey string `yaml:"encryption_key"` +} + +func GetConf() (conf Conf, err error) { + confFile, err := os.ReadFile(CONF_FILE) + if err != nil { + return + } + err = yaml.Unmarshal(confFile, &conf) + return +} diff --git a/web/web.conf.yml.example b/web/web.conf.yml.example new file mode 100644 index 0000000..76cf2b7 --- /dev/null +++ b/web/web.conf.yml.example @@ -0,0 +1,10 @@ +# Database configuration string +db_config: postgres://user:password@host:port/db?application_name=SkazaNull%20Web + +# The interface on which to run the webserver +interface: ":9672" + +# Encryption key for sessions. +# Change it to a string of exactly 16, 32 or 64 chars +# Avoid the "#" character in your APP_KEY, it may break things. +encryption_key: some_secret_key