Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadEnvironmentFile ¶
ReadEnvironmentFile will read environment variables from a passed in location. Lines that start with "#" or empty lines are ignored. Assignments are in the form name=value and no variable expansion occurs.
Types ¶
type SafeEnv ¶
type SafeEnv []string
SafeEnv allows you to build a system environment while avoiding potentially dangerous environment conditions. In addition, SafeEnv will ignore any values added if the key already exists. This allows earlier inserts to take priority and ensure there is no conflicting values.
func (*SafeEnv) AddExecEnvironment ¶
func (e *SafeEnv) AddExecEnvironment()
AddExecEnvironment will add safe values from os.Environ, ignoring any duplicates that may have already been added.
func (*SafeEnv) AddFullTrusted ¶
AddFullTrusted adds an exact value, in the KEY=VALUE format. This should only be used if they values are already combined. When the values are separate the [Add] function is generally preferred. This will not check for duplicates.
func (*SafeEnv) AddFullUnique ¶
AddFullUnique adds an exact value, in the KEY=VALUE format. This should only be used if they values are already combined. When the values are separate the [Add] function is generally preferred. If any keys already exists (case-insensitive) they will be ignored.
func (*SafeEnv) AddTrusted ¶
AddTrusted will add the key and value to the environment if it's a safe value to forward on for fork / exec. This will not check for duplicates.