75 lines
2.0 KiB
Python
75 lines
2.0 KiB
Python
import config
|
|
import os
|
|
import sys
|
|
|
|
stdout_default = sys.stdout
|
|
|
|
deploy_path = config.deploy_path
|
|
env_file_name = config.env_file_name
|
|
titles_file_name = config.titles_file_name
|
|
|
|
session_server_root_dir = deploy_path + '/pixel-streaming-session-server'
|
|
|
|
if not os.path.isdir(session_server_root_dir):
|
|
print('Package not installed')
|
|
exit()
|
|
|
|
# define config variables
|
|
server_port = config.session_server_port
|
|
server_domain = config.session_server_domain
|
|
coordinator_url = config.coordinator_url
|
|
database_url = config.local_database_url
|
|
database_name = config.local_database_name
|
|
session_begin_port = config.session_begin_port
|
|
session_limit = config.session_limit
|
|
webrtc_server_path = config.webrtc_server_path
|
|
|
|
session_server_postfix = config.session_server_postfix
|
|
applications = config.applications
|
|
|
|
# generate session server .env
|
|
|
|
env_file_path = session_server_root_dir + '/' + env_file_name
|
|
|
|
output_file = open(env_file_path, 'w')
|
|
sys.stdout = output_file
|
|
|
|
print('PORT=', server_port)
|
|
print('EXTERNAL_DOMAIN=', '"' + server_domain + '/' + session_server_postfix + '/' + '"')
|
|
print('COORDINATOR_URL=', '"' + coordinator_url + '"')
|
|
print('DATABASE_URL=', '"' + database_url + '"')
|
|
print('DATABASE_NAME=', '"' + database_name + '"')
|
|
print('WEBRTC_PORT_BEGIN=', session_begin_port)
|
|
print('SESSION_LIMIT=', session_limit)
|
|
print('WEBRTC_SERVER_PATH=', '"' + webrtc_server_path + '"')
|
|
|
|
sys.stdout = stdout_default
|
|
output_file.close()
|
|
|
|
# generate sesion server titles.json
|
|
|
|
titles_file_path = session_server_root_dir + '/' + titles_file_name
|
|
|
|
output_file = open(titles_file_path, 'w')
|
|
sys.stdout = output_file
|
|
|
|
|
|
app_last_index = len(applications)
|
|
|
|
print('[')
|
|
|
|
for i in range(0, app_last_index):
|
|
print('\t{')
|
|
print('\t\t' + '"title":"' + applications[i][0] + '",')
|
|
print('\t\t' + '"path":"' + applications[i][1] + '"')
|
|
if i == app_last_index - 1:
|
|
print('\t}')
|
|
else:
|
|
print('\t},')
|
|
|
|
print(']')
|
|
|
|
sys.stdout = stdout_default
|
|
output_file.close()
|
|
|
|
print('\nPackage configured.\n') |