def replace_config_anchors()

in source/services/webclient-setup/lambda_function.py [0:0]


def replace_config_anchors(content, resource_properties):
    content = content.replace("%%AWS_REGION%%", resource_properties["AwsRegion"])
    content = content.replace("%%BOT_NAME%%", resource_properties["BotName"])
    content = content.replace("%%API_URI%%", resource_properties["ApiUri"])
    if "CognitoIdentityPool" in resource_properties:
        content = content.replace("%%COGNITO_IDENTITY_POOL%%", resource_properties["CognitoIdentityPool"])
    else:
        content = content.replace("%%COGNITO_IDENTITY_POOL%%", "")
    if "CognitoUserPoolId" in resource_properties:
        content = content.replace("%%COGNITO_USER_POOL_ID%%", resource_properties["CognitoUserPoolId"])
    else:
        content = content.replace("%%COGNITO_USER_POOL_ID%%", "")
    if "CognitoUserPoolClientId" in resource_properties:
        content = content.replace("%%COGNITO_USER_POOL_CLIENT_ID%%", resource_properties["CognitoUserPoolClientId"])
    else:
        content = content.replace("%%COGNITO_USER_POOL_CLIENT_ID%%", "")

    voice = BOT_SPEECH_PARAMS[resource_properties["BotLanguage"]]["Voice"][resource_properties["BotGender"]]
    content = content.replace("%%BOT_VOICE%%", voice)

    language_tag = BOT_SPEECH_PARAMS[resource_properties["BotLanguage"]]["Lang"]
    content = content.replace("%%LANGUAGE_TAG%%", language_tag)

    return content