Skip to content

Expose a way to create a PlanetScale Client using the same auth method as the CLI #175

@mattrobenolt

Description

@mattrobenolt

From within planetscale/cli, everything as far as reading a config file and yanking an access token out of the OS keyring is locked away in internal packages internal to the CLI.

If I want to use this library in code, in theory, I'd like to instantiate a client that leverages my system's auth in a similar fashion. Whether this is fully depending on the config file pscale CLI writes, or just sharing some mechanism to yank an already auth'd token out of the keyring would be super nice.

This would allow tooling outside of pscale to "just work" without requiring use of the CLI.

Maybe just necessary for the keyring access being one of the constructor arguments?

client, err := planetscale.NewClient(
	planetscale.WithSystemKeyring(...),
)

or something similar is what I'm thinking. I'd like to leverage this rather than extract it and set it as an env var or pass as a flag to something else.

Thoughts?

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