Documentation ¶
Overview ¶
Package app is the collection of the methods to create or load the app configuration from the engine. The app is the collection of the services.
Depends on the engine. Managed by the handler.
Index ¶
Constants ¶
const ( EnvConfigName = "CONFIG_NAME" EnvConfigPath = "CONFIG_PATH" )
Variables ¶
This section is empty.
Functions ¶
func MakeConfigDir ¶
MakeConfigDir converts fileParams to the full file path. if the configuration file is stored in the nested directory, then those directories are created.
func ReadFileParameters ¶
The ReadFileParameters returns the file path. First it reads from a flag, then from environment variable. Lastly, read the default file.
Types ¶
type App ¶
type App struct { Services []*service.Service `json:"services" yaml:"services"` ProxyChains []*service.ProxyChain `json:"proxy_chains" yaml:"proxy_chains"` // contains filtered or unexported fields }
App is the configuration of the entire application. Consists the supported services and proxy chains.
Fields
- Services in the application
- ProxyChains list of proxies that targets to the services
func New ¶
func New() *App
New App configuration. If possible, it loads the configuration.
Loading order: - create a default app config - if app.yml exists in the root, then load it. - if, environment variable exists, then load it. - if, a flag exists, then load it.
func (*App) RegisterId ¶
RegisterId sets all ids of the all services and handlers. If there are duplicate id, then throw an error with detail information.
func (*App) ServiceByUrl ¶
ServiceByUrl returns the first service of an url type.
func (*App) SetEmptyFields ¶
func (a *App) SetEmptyFields()
SetEmptyFields sets empty value for nil fields. If the developer crated App directly, some fields might be nil