Documentation ¶
Overview ¶
Package config has the definitions and utility function required for managing configurations for the applications
Index ¶
Constants ¶
const ( //VAULT_ADDRESS is the environement variable for address of vault server VAULT_ADDRESS = "CUTTLE_AI_CONFIG_VAULT_ADDRESS" //DEFAULT_VAULT_ADDRESS is the environment variable for address of vault server DEFAULT_VAULT_ADDRESS = "VAULT_ADDR" //VAULT_TOKEN is the environment variable for vault access token VAULT_TOKEN = "CUTTLE_AI_CONFIG_VAULT_TOKEN" //VAULT_PATH is the environement variable for vault path VAULT_PATH = "CUTTLE_AI_CONFIG_VAULT_DEFAULT_PATH" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
Service is the interface to be implemented for representing a service that requires configuration
type Store ¶
type Store interface { //GetConfig returns the configuration from the store //config should be the name of the config GetConfig(config string) (Config, error) }
Store stores the configuration required for an application in a remote/local server
type Vault ¶
type Vault struct { //Config has the configuration required for connecting with the Vault server Config *api.Config //Token to commuincate with the vault server Token string //Path is the path from which the secrets has to be fetched Path string }
Vault is config store that stores the configuration in hashcopr vault It fetches the configuration from vault on demand
func NewVault ¶
NewVault will create a new vault and inits the configuration If any error found while initing the config, it will return it with nil vault Else nil error is returned.
func (*Vault) GetConfig ¶
GetConfig returns the config along with the error if any while getting the configuration from remote/local vault server. If no error happens it will return non-nil Config and nil as error. If error happens it will return the error and nil as config
func (*Vault) InitConfig ¶
InitConfig will init the configuration from environment variables The only supported method of providing configuration is environment variables.