INNER CODE UNIT · Python

sync_render_env_group_secret_file

phasehq/console · backend/api/utils/syncing/render/main.py:123

def sync_render_env_group_secret_file(
    secrets, credential_id, env_group_id, secret_file_name="secrets.env"
):
    """
    Sync secrets to a Render Environment Group as a secret file.
    This will create or update a secret file in the specified env group.
    API DOCS: https://api.render.com/docs/api#operation/createOrUpdateSecretFile
    """
    try:
        url = f"{RENDER_API_BASE_URL}/env-groups/{env_group_id}/secret-files/{secret_file_name}"
        headers = get_render_headers(credential_id)

        # Prepare the secret file content in dotenv format
        # secrets is expected to be a list of (key, value, ...) tuples
        content = "\n".join(f"{key}={value}" for key, value, *_ in secrets)

        payload = {"content": content}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…