Error page + config + docker

This commit is contained in:
William Bouzourène 2026-02-16 14:58:18 +01:00
parent 7e821296a6
commit c6c533a503
Signed by: bouzoure
GPG key ID: 423440D735B56BE2
13 changed files with 110 additions and 31 deletions

29
helpers/config.go Normal file
View file

@ -0,0 +1,29 @@
package helpers
import (
"fmt"
"github.com/pelletier/go-toml"
)
type Configuration struct {
Server struct {
Address string `toml:"address"`
Port int `toml:"port"`
} `toml:"server"`
}
func ParseConfig(filePath string) (*Configuration, error) {
var config Configuration
data, err := toml.LoadFile(filePath)
if err != nil {
return nil, fmt.Errorf("error parsing config file: %v", err)
}
err = data.Unmarshal(&config)
if err != nil {
return nil, fmt.Errorf("error parsing config file: %v", err)
}
return &config, nil
}