[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-05-19 13:18:46 +03:00
parent af343a1dd1
commit b5dc2e1d01

@ -1117,6 +1117,15 @@ def http_server(argv):
options.docker = True options.docker = True
index_section = 'autoindex on;' index_section = 'autoindex on;'
if options.public:
options.token = 'public'
location_section = 'location / {%s}' % index_section
else:
if options.token is None:
options.token = os.urandom(16).hex()
if options.docker: if options.docker:
DATA_DIR = '/usr/share/nginx' DATA_DIR = '/usr/share/nginx'
APP_DIR = '/app' APP_DIR = '/app'
@ -1126,12 +1135,7 @@ def http_server(argv):
CONF_DIR = '/opt/nginx/%s/conf/' % options.token CONF_DIR = '/opt/nginx/%s/conf/' % options.token
APP_DIR = os.path.abspath(os.path.curdir) APP_DIR = os.path.abspath(os.path.curdir)
if options.public: if not options.public:
location_section = 'location / {%s}' % index_section
else:
if options.token is None:
options.token = os.urandom(16).hex()
if not options.prefix is None: if not options.prefix is None:
path = options.prefix + options.token path = options.prefix + options.token
else: else: