...
1
18
19
20 package config
21
22 import (
23 "discovery/log"
24 )
25
26 const Version = "0.0.4b"
27
28 const DataPath = "/data"
29 const ConfigurationFileName = "p2p_faas-discovery.json"
30
31 const GetParamIp = "p2pfaas-machine-ip"
32 const GetParamName = "p2pfaas-machine-name"
33 const GetParamGroupName = "p2pfaas-machine-group-name"
34
35 const DefaultDataPath = "/data"
36 const DefaultListeningHost = "0.0.0.0"
37 const DefaultListeningPort = 19000
38 const DefaultPollTime = 120
39 const DefaultPollTimeoutTime = 5
40 const DefaultIfaceName = "eth0"
41
42
43 const DefaultMachineDeadPollsRemovingThreshold = 20
44
45 const EnvRunningEnvironment = "P2PFAAS_DEV_ENV"
46 const EnvInitServers = "P2PFAAS_INIT_SERVERS"
47 const EnvDataPath = "P2PFAAS_DATA_PATH"
48 const EnvPollTime = "P2PFAAS_POLL_TIME"
49 const EnvListeningHost = "P2PFAAS_LISTENING_HOST"
50 const EnvListeningPort = "P2PFAAS_LISTENING_PORT"
51 const EnvPollTimeout = "P2PFAAS_POLL_TIMEOUT"
52 const EnvMachineDeadPollsRemovingThreshold = "P2PFAAS_MACHINE_DEAD_POLLS_THRESHOLD"
53 const EnvDefaultIface = "P2PFAAS_DEFAULT_IFACE"
54
55 const RunningEnvironmentProduction = "production"
56 const RunningEnvironmentDevelopment = "development"
57
58
59 var configurationDynamic *ConfigurationDynamic
60 var configurationDynamicReadFromFile = false
61
62 var configurationStatic *ConfigurationStatic
63
64 func init() {
65 InitConfigurationStatic()
66 InitConfigurationDynamic()
67
68 log.Log.Info("Starting in %s environment", GetRunningEnvironment())
69 log.Log.Infof("Init with %s", GetConfigurationStaticString())
70 log.Log.Infof("Init with MachineIp=%s, MachineId=%s, MachineGroupName=%s, loadedFromFile=%t",
71 GetMachineIp(), GetMachineId(), GetMachineGroupName(), configurationDynamicReadFromFile)
72 }
73
74 func Start() {
75
76 }
77
View as plain text