84 lines
1.4 KiB
Go
84 lines
1.4 KiB
Go
package config
|
|
|
|
import (
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
var serverMode bool
|
|
var clientMode bool
|
|
|
|
// exported function(s)
|
|
func ServerMode() bool {
|
|
return serverMode
|
|
}
|
|
|
|
func ClientModeMode() bool {
|
|
return clientMode
|
|
}
|
|
|
|
func ServerListen() string {
|
|
return viper.GetString(serverListen)
|
|
}
|
|
|
|
func ServerPort() int {
|
|
return viper.GetInt(serverPort)
|
|
}
|
|
|
|
func IpProviderUrl() string {
|
|
return viper.GetString(ipProviderUrl)
|
|
}
|
|
|
|
func DyndnsUsername() string {
|
|
return viper.GetString(dyndnsUsername)
|
|
}
|
|
|
|
func DyndnsPassword() string {
|
|
return viper.GetString(dyndnsPassword)
|
|
}
|
|
|
|
func DyndnsHostname() string {
|
|
return viper.GetString(dyndnsHostname)
|
|
}
|
|
|
|
func DyndnsUrl() string {
|
|
return viper.GetString(dyndnsUrl)
|
|
}
|
|
|
|
func Interval() int {
|
|
return viper.GetInt(interval)
|
|
}
|
|
|
|
func HasValidDyndnsConfig() bool {
|
|
return len(DyndnsUsername()) > 0 &&
|
|
len(DyndnsPassword()) > 0 &&
|
|
len(DyndnsHostname()) > 0 &&
|
|
len(DyndnsUrl()) > 0
|
|
}
|
|
|
|
func NotificationEnabled() bool {
|
|
return viper.GetBool(notificatonEnabled)
|
|
}
|
|
|
|
func NotificationUsername() string {
|
|
return viper.GetString(notificationUsername)
|
|
}
|
|
|
|
func NotificationPassword() string {
|
|
return viper.GetString(notificationPassword)
|
|
}
|
|
|
|
func NotificationUrl() string {
|
|
return viper.GetString(notificationUrl)
|
|
}
|
|
|
|
func NotificationTopic() string {
|
|
return viper.GetString(notificationTopic)
|
|
}
|
|
|
|
func Help() bool {
|
|
return viper.GetBool(help)
|
|
}
|
|
|
|
func Debug() bool {
|
|
return viper.GetBool(debug)
|
|
}
|