I'm pretty new to python and Flask development. I'm primarily a frontend JavaScript/React developer.

I am building a tool that uses the Google Ads api, and their documentation had me create a yaml file with my refresh tokens and other important info.

I'm trying to deploy my flask app to render.com and I'm unsure what to do with the yaml files since I want to keep my tokens secure. Any advice?

So far I've tried adding my tokens in an env file and reading them that way, but it looks like the google ads api needs the yaml file.

Tag:google-ads-api, python, flask, deployment, yaml

Only one comment.

  1. Joey

    I checked https://github.com/googleads/google-ads-python/blob/HEAD/google-ads.yaml

    Assuming you have similar structure,

    I think

    https://stackoverflow.com/a/59950479 which uses Google's SecretsManager could solve it.

    If your API absolutely needs a yaml file and has to reference it, I wonder if you can:

    Modify your yaml file: Create a custom function that gets your env var from .env file, and modifies your .yaml file before it's used. Reference env variables in yaml (not sure if possible).

    I never used google ads API, however, based on their docs, https://developers.google.com/google-ads/api/docs/client-libs/python/configuration#configuration_using_environment_variables

    Following that should work, and simply put dummy values/var names for values in yaml file as requested to set the structure.

    In order to configure logging through environment variables, the configuration value must be a JSON object that matches the structure of the YAML keys in the sample google-ads.yaml configuration file.

Add a new comment.