Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
AppName string `json:"app_name" yaml:"app_name" toml:"app_name" hcl:"app_name"`
BaseURL string `json:"base_url" yaml:"base_url" toml:"base_url" hcl:"base_url"`
Port int `json:"port" yaml:"port" toml:"port" hcl:"port"`
Verbose bool `json:"verbose" yaml:"verbose" toml:"verbose" hcl:"verbose"`
StaticDir string `json:"static_dir" yaml:"static_dir" toml:"static_dir" hcl:"static_dir"`
ViewsDir string `json:"view_dir" yaml:"view_dir" toml:"view_dir" hcl:"view_dir"`
Database string `json:"database" yaml:"database" toml:"database" hcl:"database"`
DatabaseConn string `json:"database_conn" yaml:"database_conn" toml:"database_conn" hcl:"database_conn"`
Automigrate bool `json:"automigrate" yaml:"automigrate" toml:"automigrate" hcl:"automigrate"`
}
Config stores configurations values
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default configuration settings.
func NewConfig ¶
NewConfig reads configuration from path. The format is deduced from the file extension
- .json - is decoded as json
- .yml - is decoded as yaml
- .toml - is decoded as toml
- .hcl - is decoded as hcl
func (*Config) SyncEnv ¶
SyncEnv overrides c field's values that are set in the environment.
The environment variable names are derived from config fields by underscoring, and uppercasing the name. E.g. AppName will have a corresponding environment variable APP_NAME
NOTE only int, string and bool fields are supported and the corresponding values are set. when the field value is not supported it is ignored.
Click to show internal directories.
Click to hide internal directories.