def getGatewayPort()

in assets/scripts/SilentInstaller.py [0:0]


def getGatewayPort(configFile):
    ''' Retrieves the gateway port from the config file'''
    config = read_json_file(configFile)

    # from entity
    result = config.get('configEntities', {}).get('gatewaySettings',{}).get('port', None)

    # from key. will overwrite entity port if found.
    if 'configKeys' in config:
        if 'gateway.port' in config['configKeys']:
            key = config['configKeys']['gateway.port']
            if result != None:
                print('Warning: gateway.port key specified twice in the configuration template, using value of ' + key)
            result = key

    elif result == None:
        result = 80
        print('Warning: No gateway port specified, defaulting to port 80.')

    return result