config.py
Go to the documentation of this file.
1 
2 import os
3 import yaml
4 
5 # config data
6 gRequireUsername = 0
7 
8 gWebUser = "apache"
9 gWebUserID = None # apache
10 gWebGroupID = None # apache
11 
12 gBaseURL = "/webui/"
13 gROSURL = "/ros"
14 
15 gAuthVCode = 1574444059
16 gAuthSalt = "ir"
17 
18 gWebUserID = 33 # apache
19 gWebGroupID = 33 # apache
20 
21 gDomain = "willowgarage.com"
22 gROSBridgePort = ":8068"
23 
24 LOGIN_TIMEOUT = 60*60*4
25 
26 # 1 hour
27 REFRESH_COOKIE_TIMEOUT = 60*60
28 
29 ROS_VAR_DIR = os.environ.get("ROS_VAR_DIR", "/var/ros")
30 if ROS_VAR_DIR == "":
31  ROS_VAR_DIR = "/var/ros"
32 
33 ACTIVE_USER_FILE = os.path.join(ROS_VAR_DIR, "active_user.dat")
34 ACTIVE_USER_TIMEOUT = 3600 # after one hour of inactivity, the active user will stop being active
35 
36 VALID_USER_COOKIE_FILE = os.path.join(ROS_VAR_DIR, "user_cookie.dat")
37 
38 gDBPath = os.path.join(ROS_VAR_DIR, "db")
39 
40 ROS_CONFIG_DIR = "/etc/ros/env"
41 ROS_CONFIG_FILE = "/etc/ros/robot.yaml"
42 
43 def getSiteDBPath(module):
44  path = os.path.join(gDBPath, module)
45  return path
46 
47 def getDBPath(module):
48  path = os.path.join(gDBPath, module)
49  return path
50 
51 def createDBPath(path):
52  if not os.path.isdir(path):
53  os.makedirs(path, 0700)
54  #webChown(path)
55 
56 def webChown(path):
57  if gWebUserID is not None and gWebGroupID is not None:
58  os.chown(path, gWebUserID, gWebGroupID)
59 
61  if os.path.exists(ROS_CONFIG_FILE):
62  try:
63  with open(ROS_CONFIG_FILE, 'r') as conf:
64  return yaml.load(conf)['robot']['type']
65  except:
66  pass
67  try:
68  return open(os.path.join(ROS_CONFIG_DIR, "ROBOT")).read().strip()
69  except IOError:
70  return "desktop"
71 
73  if os.path.exists(ROS_CONFIG_FILE):
74  try:
75  with open(ROS_CONFIG_FILE, 'r') as conf:
76  return yaml.load(conf)['robot']['name']
77  except:
78  pass
79  try:
80  return open(os.path.join(ROS_CONFIG_DIR, "ROBOT_NAME")).read().strip()
81  except IOError:
82  return "localhost"
83 
84 if get_robot_type().startswith("texas"):
85  gDefaultModule = "app/texas_web_teleop/texas_web_teleop"
86 else:
87  gDefaultModule = "webui"
88 
89 gDefaultPage = "webui"
90 
91 gLobby = None
92 gHomeServer = None
93 
94 if get_robot_type().startswith("texas"):
95  gLobby = "http://priv1.texai.com"
96  gLobbyHost = "priv1.texai.com"
97  gHomeServer = gLobby + "/lobby/lobby/robot_data.py"
98  gDomain = "texai.com"
99  gROSBridgePort = ""
100  gLobbyReturnPage = "https://www.texai.com/lobby/lobby/disconnect.py"
def get_robot_type()
Definition: config.py:60
def get_robot_name()
Definition: config.py:72
def webChown(path)
Definition: config.py:56
def createDBPath(path)
Definition: config.py:51
def getSiteDBPath(module)
Definition: config.py:43
def getDBPath(module)
Definition: config.py:47


webui
Author(s): Scott Hassan
autogenerated on Mon Jun 10 2019 15:51:24