wisski-cloud-distillery/internal/config/derived.go
Tom Wiesing 7b2f79bea1
Move code into new component package
This commit cleans up the resources in the 'embed' package, and instead
moves them into subpackages of a new 'compose' package. This makes sure
that '.env' templates and docker compose contexts are located in the
same location.
2022-09-11 15:41:11 +02:00

25 lines
534 B
Go

package config
import "strings"
// This file contains derived configuration values
func (cfg Config) HTTPSEnabled() bool {
return cfg.CertbotEmail != ""
}
// Returns the default virtual host
func (cfg Config) DefaultVirtualHost() string {
VIRTUAL_HOST := cfg.DefaultDomain
if len(cfg.SelfExtraDomains) > 0 {
VIRTUAL_HOST += "," + strings.Join(cfg.SelfExtraDomains, ",")
}
return VIRTUAL_HOST
}
func (cfg Config) DefaultLetsencryptHost() string {
if !cfg.HTTPSEnabled() {
return ""
}
return cfg.DefaultVirtualHost()
}