// Copyright 2022 Terin Stock. // SPDX-License-Identifier: MPL-2.0 package main import ( "os" "olympos.io/encoding/edn" ) type Config struct { HTTP HTTPConfig `edn:"http"` CGit CGitConfig `edn:"cgit"` Git GitConfig `edn:"git"` ReposRoot string `edn:"repos-root"` } type HTTPConfig struct { Host string `end:"host"` Port int `end:"port"` } type CGitConfig struct { CGI string `edn:"cgi"` ConfigFile string `edn:"config-file"` AssetsDir string `edn:"assets-dir"` } type GitConfig struct { CGI string `edn:"cgi"` ExportAll bool `edn:"export-all"` } func readConfig(path string) (Config, error) { cfg := Config{} content, err := os.ReadFile(path) if err != nil { return cfg, err } err = edn.Unmarshal(content, &cfg) return cfg, err }