75 lines
1.6 KiB
Go
75 lines
1.6 KiB
Go
|
package config
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
|
||
|
"github.com/spf13/viper"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
// Version roughly represents the applications current version.
|
||
|
Version = "0.1"
|
||
|
// Title is the name of the application used throughout the configuration process.
|
||
|
Title = "ziggs"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
f *os.File
|
||
|
err error
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
customconfig = false
|
||
|
home string
|
||
|
configLocations []string
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
// GenConfig when toggled causes HellPot to write its default config to the cwd and then exit.
|
||
|
GenConfig = false
|
||
|
// NoColor stops zerolog from outputting color, necessary on Windows.
|
||
|
NoColor = true
|
||
|
)
|
||
|
|
||
|
// ----------------- //
|
||
|
|
||
|
// "lights"
|
||
|
|
||
|
// KnownBridge represents the part of our configuration that defines hue bridges to connect to.
|
||
|
type KnownBridge struct {
|
||
|
Hostname string `mapstructure:"hostname"`
|
||
|
Username string `mapstructure:"username"`
|
||
|
Proxy string `mapstructure:"proxy"`
|
||
|
}
|
||
|
|
||
|
// KnownBridges contains all of the bridges we already knew about from our config file.
|
||
|
var KnownBridges []KnownBridge
|
||
|
|
||
|
// "http"
|
||
|
var (
|
||
|
// HTTPBind is defined via our toml configuration file. It is the address that HellPot listens on.
|
||
|
HTTPBind string
|
||
|
// HTTPPort is defined via our toml configuration file. It is the port that HellPot listens on.
|
||
|
HTTPPort int
|
||
|
// APIKey represents our key for API authentication.
|
||
|
APIKey string
|
||
|
)
|
||
|
|
||
|
type LogLevel uint8
|
||
|
|
||
|
const (
|
||
|
Info LogLevel = iota
|
||
|
Debug
|
||
|
Trace
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
debug bool
|
||
|
trace bool
|
||
|
// Filename identifies the location of our configuration file.
|
||
|
Filename string
|
||
|
prefConfigLocation string
|
||
|
// Snek represents our instance of Viper.
|
||
|
Snek *viper.Viper
|
||
|
)
|