Documentation ¶
Index ¶
Constants ¶
const ( // FileStorage is the static configuration string for file storage FileStorage string = "file" // DBStorage is the static configuration string for database storage DBStorage string = "db" // DefaultPort is the default server port DefaultPort string = "8080" // DefaultEvalString is the default evaluation time as a string DefaultEvalString string = "5m" // DefaultEvalDuration is the default evaulation time as a Duration DefaultEvalDuration time.Duration = time.Minute * 5 )
Variables ¶
var DefaultConfig = Config{ FileConfig: FileConfig{ Directory: os.TempDir() + "/deadline", }, Server: ServerConfig{ Port: DefaultPort, }, EvalTime: DefaultEvalString, Storage: FileStorage, Logconfig: make(map[string]string), // contains filtered or unexported fields }
DefaultConfig is the default configuration
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { FileConfig FileConfig `yaml:"file_config"` DBConfig DBConfig `yaml:"db_config"` Storage string `yaml:"storage"` EvalTime string `yaml:"eval_timing"` Server ServerConfig `yaml:"server_config"` EmailConfig EmailConfig `yaml:"email_config"` Logconfig map[string]string `yaml:"logs"` // contains filtered or unexported fields }
Config represents the configuration struct for the entire deadline application
func GetConfig ¶
func GetConfig() *Config
GetConfig will return a global instance of the configuration if it has ever been loaded through LoadConfig. It can also return the default config if LoadConfig has never been called.
func LoadConfig ¶
LoadConfig loads the configuration based on the input file. Errors can occur for various i/o or marshalling related reasons. Defaults will be returned for primitive types, like strings.
func (*Config) GetEvalTime ¶
GetEvalTime is a simple facade for getting the configuration's EvalTime while parsing and checking for errors.
type DBConfig ¶
type DBConfig struct {
ConnectionString string `yaml:"connection_string"`
}
DBConfig is the configuration type for relational database storage
type EmailConfig ¶
type EmailConfig struct { From string `yaml:"from"` RelayHost string `yaml:"relay_host"` RelayPort int `yaml:"relay_port"` }
EmailConfig is the configuration type for handlers that email
func GetEmailConfig ¶
func GetEmailConfig() *EmailConfig
GetEmailConfig will the EmailConfig portion of the global config object.
type FileConfig ¶
type FileConfig struct {
Directory string `yaml:"directory"`
}
FileConfig is the configuration type for file storage
type HandlerConfig ¶
type HandlerConfig struct {
EmailConfig EmailConfig `yaml:"emailconfig"`
}
HandlerConfig is the configuration type for handlers
type ServerConfig ¶
type ServerConfig struct {
Port string `yaml:"port"`
}
ServerConfig is the configuration type for the deadline server