def process_config()

in python/remote-control-center/HydrateConfigTableLambda/lambda_function.py [0:0]


def process_config(item, language_codes):
    try:
        collection_id = item["CollectionId"]
        config_id = item["ConfigId"]
        config_type = item["ConfigType"]
        default_response = item["DefaultResponse"]

        if item["ConfigType"] == "STATIC_ROUTING":
            return item

        elif item["ConfigType"] == "LANGUAGE_ROUTING":
            translations = build_translation_dict(item["DefaultResponse"], language_codes, False)
            item.update(translations)
            return item

        elif item["ConfigType"] == "MESSAGE":
            translations = build_translation_dict(item["DefaultResponse"], language_codes)
            item.update(translations)
            return item

    except Exception as e:
        print(e)
        print("Failed to load config ", item)