...

Package config

import "discovery/config"
Overview
Index

Overview ▾

Package config implements configuration of the service

Constants

const ConfigurationFileName = "p2p_faas-discovery.json"
const DataPath = "/data"
const DefaultDataPath = "/data"
const DefaultIfaceName = "eth0"
const DefaultListeningHost = "0.0.0.0"
const DefaultListeningPort = 19000

DefaultMachineDeadPollsRemovingThreshold tells the number of times we need to poll the machine for removing it from the db

const DefaultMachineDeadPollsRemovingThreshold = 20
const DefaultPollTime = 120 // seconds
const DefaultPollTimeoutTime = 5 // seconds
const EnvDataPath = "P2PFAAS_DATA_PATH"
const EnvDefaultIface = "P2PFAAS_DEFAULT_IFACE"
const EnvInitServers = "P2PFAAS_INIT_SERVERS"
const EnvListeningHost = "P2PFAAS_LISTENING_HOST"
const EnvListeningPort = "P2PFAAS_LISTENING_PORT"
const EnvMachineDeadPollsRemovingThreshold = "P2PFAAS_MACHINE_DEAD_POLLS_THRESHOLD"
const EnvPollTime = "P2PFAAS_POLL_TIME"
const EnvPollTimeout = "P2PFAAS_POLL_TIMEOUT"
const EnvRunningEnvironment = "P2PFAAS_DEV_ENV"
const GetParamGroupName = "p2pfaas-machine-group-name"
const GetParamIp = "p2pfaas-machine-ip"
const GetParamName = "p2pfaas-machine-name"
const RunningEnvironmentDevelopment = "development"
const RunningEnvironmentProduction = "production"
const Version = "0.0.4b"

func CreateDataFolder

func CreateDataFolder() error

func GetConfigurationDynamicFilePath

func GetConfigurationDynamicFilePath() string

func GetConfigurationStaticString

func GetConfigurationStaticString() string

func GetDataPath

func GetDataPath() string

func GetDefaultIface

func GetDefaultIface() string

func GetInitServers

func GetInitServers() []string

func GetListeningHost

func GetListeningHost() string

func GetListeningPort

func GetListeningPort() uint

func GetMachineDeadPollsRemovingThreshold

func GetMachineDeadPollsRemovingThreshold() uint

func GetMachineGroupName

func GetMachineGroupName() string

func GetMachineId

func GetMachineId() string

func GetMachineIp

func GetMachineIp() string

func GetPollTime

func GetPollTime() uint

func GetPollTimeout

func GetPollTimeout() uint

func GetRunningEnvironment

func GetRunningEnvironment() string

func InitConfigurationDynamic

func InitConfigurationDynamic()

InitConfigurationDynamic prepare the configuration object, returns if config is read from file

func InitConfigurationStatic

func InitConfigurationStatic()

func SaveConfigurationDynamicToConfigFile

func SaveConfigurationDynamicToConfigFile() error

func SetInitServers

func SetInitServers(servers []string)

func SetMachineFogNetId

func SetMachineFogNetId(id string)

func SetMachineId

func SetMachineId(id string)

func SetMachineIp

func SetMachineIp(ip string)

func Start

func Start()

type ConfigError

type ConfigError struct{}

func (ConfigError) Error

func (ConfigError) Error() string

type ConfigurationDynamic

type ConfigurationDynamic struct {
    MachineIp        string   `json:"machine_ip" bson:"machine_ip"`
    MachineId        string   `json:"machine_id" bson:"machine_id"`
    MachineGroupName string   `json:"machine_group_name" bson:"machine_group_name"`
    InitServers      []string `json:"init_servers" bson:"init_servers"`
}

func GetConfigurationDynamicCopy

func GetConfigurationDynamicCopy() *ConfigurationDynamic

func GetDefaultConfigurationDynamic

func GetDefaultConfigurationDynamic() *ConfigurationDynamic

func ReadConfigurationDynamicFromFile

func ReadConfigurationDynamicFromFile() (*ConfigurationDynamic, error)

type ConfigurationStatic

type ConfigurationStatic struct {
    PollTime                          uint   `json:"poll_time" bson:"poll_time"`
    DataPath                          string `json:"data_path" bson:"data_path"`
    ListeningHost                     string `json:"listening_host" bson:"listening_host"`
    ListeningPort                     uint   `json:"listening_port" bson:"listening_port"`
    PollTimeout                       uint   `json:"poll_timeout" bson:"poll_timeout"`
    MachineDeadPollsRemovingThreshold uint   `json:"machine_dead_polls_removing_threshold" bson:"machine_dead_polls_removing_threshold"`
    RunningEnvironment                string `json:"running_environment" bson:"running_environment"`
    DefaultIface                      string `json:"default_iface" bson:"default_iface"`
}

func GetDefaultConfigurationStatic

func GetDefaultConfigurationStatic() *ConfigurationStatic