config

package
Version: v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Environment

func Environment() string

Environment returns the current environment for the application;

it could be: development, testing, production

func GetEnvVar added in v0.1.10

func GetEnvVar(key string) string

GetEnvVar gets a `key` from the environment variables

func IsEnvironment

func IsEnvironment(env string) bool

IsEnvironment checks if the current environment for the application

is the same as defined in `env`

func LoadConfig added in v0.1.10

func LoadConfig()

LoadConfig loads the globalConfig structure from a JSON-based stream:

  1. it attempts to load it from the .config.local.json file;
  2. it checks for the .config.yml file and loads it from Vault; or
  3. it fails without any configuration option available

func SetConfig

func SetConfig(config Config)

SetConfig sets the global configuration struct for the application

Types

type Config added in v0.1.10

type Config struct {
	ApplicationKey      string `json:"application_key"`
	DatastoreHost       string `json:"datastore_host"`
	DatastoreNamePrefix string `json:"datastore_name_prefix"`
	DatastorePassword   string `json:"datastore_password"`
	DatastoreSslMode    string `json:"datastore_ssl_mode"`
	DatastoreUser       string `json:"datastore_user"`
	MailFrom            string `json:"mail_from"`
	MailerAccess        string `json:"mailer_access"`
	MemorystoreHost     string `json:"memory_store_host"`
	MemorystoreIndex    int    `json:"memory_store_index"`
	MemorystorePassword string `json:"memory_store_password"`
	MemorystorePort     int    `json:"memory_store_port"`
	SessionSecret       string `json:"session_secret"`
	SessionSecure       bool   `json:"session_secure"`
	StorageSecret       string `json:"storage_secret"`
}

Config struct with configuration data for the application

func GetGlobalConfig added in v0.1.10

func GetGlobalConfig() Config

GetGlobalConfig returns the global configuration struct for the application

type Service added in v0.1.10

type Service struct {
	Space struct {
		ConfigurationStore struct {
			Addr  string `yaml:"addr"`
			Token string `yaml:"token"`
			Path  string `yaml:"path"`
		} `yaml:"configuration_store"`
	} `yaml:"space"`
}

Service struct with data to retrieve a Vault secret

func (*Service) LoadService added in v0.1.10

func (s *Service) LoadService(filepath string)

LoadService loads a Vault secret

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL