This repository has been archived on 2025-11-25. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
combluotion-old/config/config.go

39 lines
1 KiB
Go

package config
import (
"github.com/BurntSushi/toml"
"github.com/kirsle/configdir"
"path/filepath"
)
type Config struct {
Domain string `toml:"domain"`
Username string `toml:"username"`
Password string `toml:"admin_password"`
Name string `toml:"name"`
Summary string `toml:"summary"`
Https bool `toml:"https"`
IconUrl string `toml:"icon_url""`
ImageUrl string `toml:"image_url"`
Secret string `toml:"secret"`
TrustedHosts []string `toml:"trusted_hosts"`
ManuallyApproveFollers bool `toml:"manually_approves_followers"`
}
var config Config
func init() {
configPath := configdir.LocalConfig("gopub")
if err := configdir.MakePath(configPath); err != nil {
panic(err)
}
configFile := filepath.Join(configPath, "profile.toml")
if _, err := toml.DecodeFile(configFile, &config); err != nil {
panic(err)
}
}
func GetConfig() Config {
return config
}