make CLI configurable

This commit is contained in:
m5r
2024-07-26 12:16:23 +02:00
parent c3220327e1
commit c7989fa736
15 changed files with 468 additions and 251 deletions

29
utils/config.go Normal file
View File

@ -0,0 +1,29 @@
package utils
import (
"github.com/spf13/viper"
)
type config struct {
DnsPort uint `mapstructure:"dns-port"`
HttpPort uint `mapstructure:"http-port"`
HttpsPort uint `mapstructure:"https-port"`
Domain string
Email string
NameServers []string
CADirURL string
AccountFilePath string
KeyFilePath string
}
var conf = &config{}
func InitConfig() *config {
viper.Unmarshal(conf)
return conf
}
func GetConfig() *config {
return conf
}