import os import bcrypt WMSAPP_HOME = os.path.realpath('/usr/local/WowzaStreamingEngine') def wowza_license(): if 'WSE_LIC' in os.environ: with open(f'{WMSAPP_HOME}/conf/Server.license', 'w') as f: f.write(f'-----BEGIN LICENSE-----\n{os.environ["WSE_LIC"]}\n-----END LICENSE-----\n') def wowza_manager_creds(): mgrUser = os.getenv('WSE_MGR_USER', 'wowza') mgrPass = os.getenv('WSE_MGR_PASS', 'wowza') # Hash the password using bcrypt hashed_password = bcrypt.hashpw(mgrPass.encode('utf-8'), bcrypt.gensalt()) with open(f'{WMSAPP_HOME}/conf/admin.password', 'w') as f: f.write(f'{mgrUser} {hashed_password.decode()} admin|advUser bcrypt\n')