Files
link-shortening-service/internal/config/config.go
2026-06-02 19:24:50 +02:00

28 lines
455 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("/home/kocoder/src/go/shortener/settings.json")
if err != nil {
panic(err)
}
var config Config
err = json.Unmarshal(file, &config)
if err != nil {
panic(err)
}
return &config
}