mirror of
https://github.com/Py-KMS-Organization/py-kms.git
synced 2025-05-13 06:34:45 -04:00
Fix for missing environment variables
This commit is contained in:
parent
b00e743eaf
commit
4ee742d671
1 changed files with 8 additions and 6 deletions
|
@ -19,17 +19,19 @@ argumentVariableMapping = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build the command to execute
|
# Build the command to execute
|
||||||
command = ['/usr/bin/python3', 'pykms_Server.py', os.environ.get('IP'), os.environ.get('PORT')]
|
listenIP = os.environ.get('IP', '0.0.0.0')
|
||||||
|
listenPort = os.environ.get('PORT', '1688')
|
||||||
|
command = ['/usr/bin/python3', 'pykms_Server.py', listenIP, listenPort]
|
||||||
for (arg, env) in argumentVariableMapping.items():
|
for (arg, env) in argumentVariableMapping.items():
|
||||||
if env in os.environ and os.environ.get(env) != '':
|
if env in os.environ and os.environ.get(env) != '':
|
||||||
command.append(arg)
|
command.append(arg)
|
||||||
command.append(os.environ.get(env))
|
command.append(os.environ.get(env))
|
||||||
|
|
||||||
enableSQLITE = os.environ.get('SQLITE') != None and os.environ.get('SQLITE').lower() == 'true'
|
enableSQLITE = os.environ.get('SQLITE', 'false').lower() == 'true'
|
||||||
os.makedirs('db', exist_ok=True)
|
|
||||||
dbPath = os.path.join('db', 'pykms_database.db')
|
|
||||||
if enableSQLITE:
|
if enableSQLITE:
|
||||||
print('Storing database file to ' + dbPath)
|
print('Storing database file to ' + dbPath)
|
||||||
|
dbPath = os.path.join('db', 'pykms_database.db')
|
||||||
|
os.makedirs('db', exist_ok=True)
|
||||||
command.append('-s')
|
command.append('-s')
|
||||||
command.append(dbPath)
|
command.append(dbPath)
|
||||||
|
|
||||||
|
@ -40,8 +42,8 @@ if enableSQLITE:
|
||||||
time.sleep(5) # The server may take a while to start
|
time.sleep(5) # The server may take a while to start
|
||||||
if not os.path.isfile(dbPath):
|
if not os.path.isfile(dbPath):
|
||||||
# Start a dummy activation to ensure the database file is created
|
# Start a dummy activation to ensure the database file is created
|
||||||
subprocess.run(['/usr/bin/python3', 'pykms_Client.py', os.environ.get('IP'), os.environ.get('PORT'), '-m', 'Windows10', '-n', 'DummyClient', '-c', 'ae3a27d1-b73a-4734-9878-70c949815218'])
|
subprocess.run(['/usr/bin/python3', 'pykms_Client.py', listenIP, listenPort, '-m', 'Windows10', '-n', 'DummyClient', '-c', 'ae3a27d1-b73a-4734-9878-70c949815218'])
|
||||||
sqliteProcess = subprocess.Popen(['/usr/bin/python3', '/home/sqlite_web/sqlite_web.py', '-H', os.environ.get('IP'), '--read-only', '-x', dbPath, '-p', os.environ.get('SQLITE_PORT')])
|
sqliteProcess = subprocess.Popen(['/usr/bin/python3', '/home/sqlite_web/sqlite_web.py', '-H', listenIP, '--read-only', '-x', dbPath, '-p', os.environ.get('SQLITE_PORT', 8080)])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pykmsProcess.wait()
|
pykmsProcess.wait()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue