Skip to content

Convenient alternative to LoadFromStorage for in-memory credentials #162

@lanzz

Description

@lanzz

We want to move all of our API credentials into a secret management system (e.g. http://vaultproject.io). This presents us with a challenge with the initialization of the googleads client, because it absolutely requires an actual file that can be accessed in the filesystem by name, and we only have the YAML as a string in memory. It seems we can do only one of two things:

  • Save the credentials to a temporary file and make sure we delete it every time we want to initialize the client
  • Copy the entire implementation of LoadFromStorage only to modify a couple of lines there to use the in-memory configuration rather than open+read a file

Neither seems a reasonable approach. Ideally, the SDK should support shorthand initialization from other representations of the YAML data; either it should accept a file-like readable instance instead of a filename (so we could pass in a StringIO), or it should accept an actual pre-parsed data structure (so we could pass in a dictionary as it would have been returned by yaml.safe_load()).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions