mirror of
https://github.com/jsiebens/ionscale.git
synced 2026-03-31 15:07:49 +01:00
feat: configure magic dns suffix
This commit is contained in:
@@ -16,10 +16,24 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
KeepAliveInterval = 1 * time.Minute
|
||||
const (
|
||||
defaultKeepAliveInterval = 1 * time.Minute
|
||||
defaultMagicDNSSuffix = "ionscale.net"
|
||||
)
|
||||
|
||||
var (
|
||||
keepAliveInterval = defaultKeepAliveInterval
|
||||
magicDNSSuffix = defaultMagicDNSSuffix
|
||||
)
|
||||
|
||||
func KeepAliveInterval() time.Duration {
|
||||
return keepAliveInterval
|
||||
}
|
||||
|
||||
func MagicDNSSuffix() string {
|
||||
return magicDNSSuffix
|
||||
}
|
||||
|
||||
func LoadConfig(path string, flagsCfg *Config) (*Config, error) {
|
||||
cfg := defaultConfig()
|
||||
|
||||
@@ -59,6 +73,9 @@ func LoadConfig(path string, flagsCfg *Config) (*Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
keepAliveInterval = cfg.PollNet.KeepAliveInterval
|
||||
magicDNSSuffix = cfg.DNS.MagicDNSSuffix
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
@@ -79,8 +96,15 @@ func defaultConfig() *Config {
|
||||
AcmeCA: certmagic.LetsEncryptProductionCA,
|
||||
AcmePath: "./acme",
|
||||
},
|
||||
PollNet: PollNet{KeepAliveInterval: 1 * time.Minute},
|
||||
Logging: Logging{Level: "info"},
|
||||
PollNet: PollNet{
|
||||
KeepAliveInterval: defaultKeepAliveInterval,
|
||||
},
|
||||
DNS: DNS{
|
||||
MagicDNSSuffix: defaultMagicDNSSuffix,
|
||||
},
|
||||
Logging: Logging{
|
||||
Level: "info",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +124,7 @@ type Config struct {
|
||||
Keys Keys `yaml:"keys,omitempty" envPrefix:"KEYS_"`
|
||||
Database Database `yaml:"database,omitempty" envPrefix:"DB_"`
|
||||
AuthProvider AuthProvider `yaml:"auth_provider,omitempty"`
|
||||
DNS DNS `yaml:"dns,omitempty"`
|
||||
Logging Logging `yaml:"logging,omitempty" envPrefix:"LOGGING_"`
|
||||
}
|
||||
|
||||
@@ -143,6 +168,10 @@ type AuthProvider struct {
|
||||
SystemAdminPolicy SystemAdminPolicy `yaml:"system_admins"`
|
||||
}
|
||||
|
||||
type DNS struct {
|
||||
MagicDNSSuffix string `yaml:"magic_dns_suffix"`
|
||||
}
|
||||
|
||||
type SystemAdminPolicy struct {
|
||||
Subs []string `json:"subs,omitempty"`
|
||||
Emails []string `json:"emails,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user