Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnv ¶ added in v0.13.0
GetEnv is a helper function that retrieves a value from an environment variable independently if is has the env notation or not.
func HasEnvNotation ¶ added in v0.13.0
HasEnvNotation checks if a string has the mikros framework env notation indicating that it should be loaded from environment variables.
func Load ¶
Load loads environment variables directly into structures by using a special struct tag 'env'.
The 'env' tag allows defining the environment variable name that points to the struct member by using the tag first argument. It also allows setting a default value, with the attribute 'default_value', for variables that are not found, and an attribute 'skip' to skip members of being loaded.
The function also receives the service name as argument so it can search for environment variables specific to the own service, and to be one specific to the service, the environment variable must end (have as suffix) a dot '.' followed by the service name. Like:
FOO => global variable, for all services FOO.bar => variable only for service 'bar'