This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
analytics/ingest/config/config.go
AKP f3c3dd1e7d
Update default listener address
Signed-off-by: AKP <tom@tdpain.net>
2023-04-05 17:41:31 +01:00

29 lines
540 B
Go

package config
import (
"github.com/codemicro/analytics/ingest/config/internal/debug"
)
var Debug = debug.Enable
type Config struct {
Ingest struct {
Address string
}
Database struct {
DSN string
}
}
func Load() (*Config, error) {
cl := new(configLoader)
if err := cl.load("config.yml"); err != nil {
return nil, err
}
conf := new(Config)
conf.Ingest.Address = asString(cl.withDefault("ingest.address", "0.0.0.0:7500"))
conf.Database.DSN = asString(cl.withDefault("database.dsn", "analytics.db"))
return conf, nil
}