forked from gucorpling/gitdox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaths.py
executable file
·38 lines (30 loc) · 1.01 KB
/
paths.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
import requests, os, platform
from modules.configobj import ConfigObj
# Support IIS site prefix on Windows
if platform.system() == "Windows":
prefix = "transc\\"
else:
prefix = ""
gitdox_root = os.path.dirname(os.path.realpath(__file__))
# to use password authentication, use a netrc file called .netrc in the project root
try:
ether_url = ConfigObj(gitdox_root + os.sep + "users" + os.sep + "config.ini")["ether_url"]
if not ether_url.endswith(os.sep):
ether_url += os.sep
except KeyError:
ether_url = ""
def get_menu():
config = ConfigObj(prefix + "users" + os.sep + "config.ini")
if "banner" not in config:
return ""
banner = config["banner"]
if banner.startswith("http"): # Web resource
resp = requests.get(banner)
return resp.text
else: # File name in templates/ dir
banner = config["banner"]
banner = open(prefix + "templates" + os.sep + banner).read()
return banner
def get_nlp_credentials():
config = ConfigObj("users" + os.sep + "config.ini")
return config["nlp_user"], config["nlp_password"]