mirror of
https://github.com/release-engineering/dist-git.git
synced 2025-02-23 23:12:55 +00:00
Move config parsing to its own function
At the same time, allow to use a non-default config file by specifying its path in `DISTGIT_CONFIG` environment variable.
This commit is contained in:
parent
25a94ec4e7
commit
57eac00d19
1 changed files with 10 additions and 3 deletions
|
@ -26,6 +26,9 @@ BUFFER_SIZE = 4096
|
||||||
# Fedora Packager Group
|
# Fedora Packager Group
|
||||||
PACKAGER_GROUP = 'packager'
|
PACKAGER_GROUP = 'packager'
|
||||||
|
|
||||||
|
# Path to a config file
|
||||||
|
CONFIG = os.environ.get('DISTGIT_CONFIG', '/etc/dist-git/dist-git.conf')
|
||||||
|
|
||||||
|
|
||||||
def send_error(text, status='500 Internal Server Error'):
|
def send_error(text, status='500 Internal Server Error'):
|
||||||
"""Send an error back to the client
|
"""Send an error back to the client
|
||||||
|
@ -122,11 +125,15 @@ def ensure_namespaced(name, namespace):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
|
def get_config():
|
||||||
|
config = ConfigParser()
|
||||||
|
config.read(CONFIG)
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
form = cgi.FieldStorage()
|
form = cgi.FieldStorage()
|
||||||
|
config = get_config()
|
||||||
config = ConfigParser()
|
|
||||||
config.read('/etc/dist-git/dist-git.conf')
|
|
||||||
os.umask(0o002)
|
os.umask(0o002)
|
||||||
|
|
||||||
username = os.environ.get('SSL_CLIENT_S_DN_CN', None)
|
username = os.environ.get('SSL_CLIENT_S_DN_CN', None)
|
||||||
|
|
Loading…
Add table
Reference in a new issue