-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.py~
174 lines (131 loc) · 4.25 KB
/
configuration.py~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#Configuration file
import datetime
import os
def GetConfig(request):
##################################
# IP Acceptance
if request == "ENABLE_IP_SCREENING":
#return 'True'
return 'False'
if request == "ALLOWED_IP":
return '192.168.5.3'
##################################
# Django Settings
if request == "COMPANY_NAME":
return '4GTSS'
if request == "SERVER_URL":
return 'http://demo.4gtss.com:9999'
if request == "ROOT_DIR":
return '/4gtss/mount'
##################################
# Django Settings
if request == "DEBUG":
#return 'True'
return 'False'
if request == "TIME_ZONE":
return 'Asia/Bahrain'
##################################
# Default/Main Database Settings
if request == "DEFAULT_DB_HOST":
return 'localhost'
if request == "DEFAULT_DB_NAME":
return 'npg_system'
if request == "DEFAULT_DB_USER":
return 'npg'
if request == "DEFAULT_DB_PASSWORD":
return 'pNcKyYw3qUyP7MxR'
##################################
# Voice Gateway Database Settings
if request == "ENABLE_VOICEGATWAY_UPDATE":
#return 'TRUE'
return 'FALSE'
# Keep duplicate of voice gateway database locally
if request == "ENABLE_LOCALDB_UPDATE":
#return 'TRUE'
return 'FALSE'
if request == "VGW_DB_NAME":
return 'npg_system_demo2'
#return 'vgwlive'
if request == "VGW_TABLE_NAME":
return 'npg_vgw'
if request == "VGW_DB_HOST":
return 'localhost'
if request == "VGW_DB_USER":
return 'npg_demo'
if request == "VGW_DB_PASSWORD":
return 'pNcKyYw3qUyP7MxR'
##################################
# Operator's Settings
if request == "ORIGINATION_ID":
return 'RWAB'
if request == "DESTINATION_ID":
return 'CSYS'
##################################
# Central System Settings - SUDS Connection
if request == "SOAP_CONNECTION":
return 'TEST'
#return 'LIVE'
# For Live server
if request == "CSL":
return {
'url' : 'https://m2m.npcs.bh/services/NpcdbService?wsdl',
'user' : 'soap_rwab',
'password' : 'pass_4gtss',
}
# For the test server
if request == "CST":
return {
'url' : 'https://m2m.test.npcs.bh/services/NpcdbService?wsdl',
'user' : 'soap_rwab',
'password' : 'pass_4gtss',
}
##################################
# XSD Settings
if request == "XSD_LOCATION":
return GetConfig("ROOT_DIR") + '/site/npg/soap/xsd/nptypes.xsd'
# for windows use: 'M:/site/hazimsite/wsdl/nptypes.xsd'
# for Linux use: GetConfig("ROOT_DIR") + '/site/npg/wsdl/nptypes.xsd'
##################################
# E-Mail Settings
if request == "ENABLE_EMAIL":
return 'TRUE'
if request == "AUTHENTICATE_USER":
return 'noreply@lightspeed.local'
if request == "AUTHENTICATE_PASS":
return 'lightspeed'
if request == "FROM_EMAIL":
return 'noreply@4gtss.com'
if request == "RECIPIENT_LIST":
return [
'hazim.samour@solutionsfortelecom.com',
]
##################################
# Logging Function
def LogInput(NewLog):
now = datetime.datetime.now()
year = "0" + str(now.year) if len(str(now.year)) == 1 else str(now.year)
month = "0" + str(now.month) if len(str(now.month)) == 1 else str(now.month)
day = "0" + str(now.day) if len(str(now.day)) == 1 else str(now.day)
dir = GetConfig("ROOT_DIR") + '/site/npg/report/' + year + "/" + month
if not os.path.exists(dir):
os.makedirs(dir)
LogFileName = dir + "/" + day
LogFile = open(LogFileName, "a")
TimeStamp = "[%s] " % (GetTimeStamp())
LogFile.write("".join(TimeStamp))
LogFile.write("".join(NewLog))
LogFile.write("".join("\n"))
LogFile.close()
def GetTimeStamp():
now = datetime.datetime.now()
year = "0" + str(now.year) if len(str(now.year)) == 1 else str(now.year)
month = "0" + str(now.month) if len(str(now.month)) == 1 else str(now.month)
day = "0" + str(now.day) if len(str(now.day)) == 1 else str(now.day)
hour = "0" + str(now.hour) if len(str(now.hour)) == 1 else str(now.hour)
minute = "0" + str(now.minute) if len(str(now.minute)) == 1 else str(now.minute)
second = "0" + str(now.second) if len(str(now.second)) == 1 else str(now.second)
millisecond = str(now.microsecond / 1000)
millisecond = "0" + millisecond if len(millisecond) == 2 else millisecond
millisecond = "00" + millisecond if len(millisecond) == 1 else millisecond
return "%s-%s-%s %s:%s:%s,%s" % (year,month,day,hour,minute,second,millisecond)
s