Documentation ¶
Overview ¶
config helper for cache, mq, and worker
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This file is a wholesale copy of https://github.com/mitchellh/go-homedir@1f6da4a72e57d4e7edd4a7295a585e0a3999a2d4 with Dir() renamed to homeDir() and Expand() deleted.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Presets = map[string]Settings{ "worker": Settings{ Scheme: "https", Port: 443, ApiVersion: "2", Host: "worker-aws-us-east-1.iron.io", UserAgent: "iron_go/worker 2.0 (Go " + goVersion + ")", }, "mq": Settings{ Scheme: "https", Port: 443, ApiVersion: "1", Host: "mq-aws-us-east-1.iron.io", UserAgent: "iron_go/mq 1.0 (Go " + goVersion + ")", }, "cache": Settings{ Scheme: "https", Port: 443, ApiVersion: "1", Host: "cache-aws-us-east-1.iron.io", UserAgent: "iron_go/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 ¶
Config gathers configuration from env variables and json config files. Examples of fullProduct are "iron_worker", "iron_cache", "iron_mq".
func ConfigWithEnv ¶
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 ¶
ManualConfig gathers configuration from env variables, json config files and finally overwrites it with specified instance of Settings.
func (*Settings) UseConfigFile ¶
Load and merge the given JSON config file.
func (*Settings) UseConfigMap ¶
Merge the given data into the settings.
func (*Settings) UseSettings ¶
Merge the given instance into the settings.