config

package
v0.0.0-...-97b4fb6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

config helper for cache, mq, and worker

Index

Constants

This section is empty.

Variables

View Source
var (
	Presets = map[string]Settings{
		"worker": Settings{
			Scheme:     "https",
			Port:       443,
			ApiVersion: "2",
			Host:       "worker-aws-us-east-1.iron.io",
			UserAgent:  "iron_go3/worker 2.0 (Go " + goVersion + ")",
		},
		"mq": Settings{
			Scheme:     "https",
			Port:       443,
			ApiVersion: "3",
			Host:       "mq-aws-us-east-1-1.iron.io",
			UserAgent:  "iron_go3/mq 3.0 (Go " + goVersion + ")",
		},
		"cache": Settings{
			Scheme:     "https",
			Port:       443,
			ApiVersion: "1",
			Host:       "cache-aws-us-east-1.iron.io",
			UserAgent:  "iron_go3/cache 1.0 (Go " + goVersion + ")",
		},
	}
)

Functions

This section is empty.

Types

type Settings

type Settings struct {
	Token      string `json:"token,omitempty"`
	ProjectId  string `json:"project_id,omitempty"`
	Host       string `json:"host,omitempty"`
	Scheme     string `json:"scheme,omitempty"`
	Port       uint16 `json:"port,omitempty"`
	ApiVersion string `json:"api_version,omitempty"`
	UserAgent  string `json:"user_agent,omitempty"`
}

Contains the configuration for an iron.io service. An empty instance is not usable

func Config

func Config(fullProduct string) (settings Settings)

Config gathers configuration from env variables and json config files. Examples of fullProduct are "iron_worker", "iron_cache", "iron_mq".

func ConfigWithEnv

func ConfigWithEnv(fullProduct, env string) (settings Settings)

Like Config, but useful for keeping multiple dev environment information in one iron.json config file. If env="", works same as Config.

e.g.

{
    "production": {
        "token": ...,
        "project_id": ...
    },
    "test": {
        ...
    }
}

func ManualConfig

func ManualConfig(fullProduct string, configuration *Settings) (settings Settings)

ManualConfig gathers configuration from env variables, json config files and finally overwrites it with specified instance of Settings. Examples of fullProduct are "iron_worker", "iron_cache", "iron_mq" and

func (*Settings) UseConfigFile

func (s *Settings) UseConfigFile(family, product, path, env string)

Load and merge the given JSON config file.

func (*Settings) UseConfigMap

func (s *Settings) UseConfigMap(data map[string]interface{})

Merge the given data into the settings.

func (*Settings) UseSettings

func (s *Settings) UseSettings(settings *Settings)

Merge the given instance into the settings.

Jump to

Keyboard shortcuts

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