28 lines
426 B
Go
28 lines
426 B
Go
package config
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
type Config struct {
|
|
DB_URL string `json:"db_url"`
|
|
TRUSTED_PROXIES []string `json:"trusted_proxies"`
|
|
OTLP_ENDPOINT string `json:"otlp_endpoint"`
|
|
}
|
|
|
|
func Read() *Config {
|
|
file, err := os.ReadFile("./settings.json")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
var config Config
|
|
err = json.Unmarshal(file, &config)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return &config
|
|
}
|