highscore-server/src/config.v

34 lines
608 B
Coq
Raw Normal View History

2023-01-07 13:00:00 +01:00
module main
import toml
const (
path = './config.toml'
2023-01-07 13:00:00 +01:00
)
struct Config {
2023-01-11 19:08:24 +01:00
host string
port int
token string
redirect bool
2023-01-07 13:00:00 +01:00
redirect_url string
2023-01-11 19:08:24 +01:00
db_path string
2023-01-07 13:00:00 +01:00
}
fn (config Config) copy() Config {
return config
}
2023-01-07 13:00:00 +01:00
fn load_config() Config {
config := toml.parse_file(path) or { panic(err) }
2023-01-11 19:08:24 +01:00
return Config{
host: config.value('host').string()
port: config.value('port').int()
token: config.value('token').string()
redirect: config.value('redirect').bool()
redirect_url: config.value('redirect_url').string()
db_path: config.value('db_path').string()
2023-01-07 13:00:00 +01:00
}
}