Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from organisation keys to PATs #79

Merged
merged 6 commits into from
Nov 28, 2023
Merged

Migrate from organisation keys to PATs #79

merged 6 commits into from
Nov 28, 2023

Conversation

RealOrangeOne
Copy link
Contributor

@RealOrangeOne RealOrangeOne commented Sep 23, 2023

Fixes #78

@tlimoncelli
Copy link

Is this a breaking change? Should the major version be bumped?

@RealOrangeOne
Copy link
Contributor Author

Is this a breaking change? Should the major version be bumped?

Yes, and yes. I've not done any versioning changes here as those should be done as part of the release step.

@RealOrangeOne
Copy link
Contributor Author

@nlewo (sorry for the ping) anything I can do to help progress this along? Keen to get PATs supported ASAP so it can be included in the terraform provider too.

@nlewo
Copy link
Member

nlewo commented Nov 2, 2023

Hello @RealOrangeOne
Sorry for the delay, so thx for the ping!

I actually would prefer to keep the support of the API key even if it is deprecated, because this is still used by a lot of people. Also, some other projects decided to still support both (lego for instance).
Ideally, a log message could inform the user the API Key is deprecated in favor of PAT.

cmd/gandi.go Outdated Show resolved Hide resolved
@RealOrangeOne RealOrangeOne marked this pull request as draft November 2, 2023 21:18
@RealOrangeOne RealOrangeOne marked this pull request as ready for review November 2, 2023 21:32
@RealOrangeOne
Copy link
Contributor Author

I've pushed some tweaks. The API isn't perfect, as we still prompt for both values even though only one is used - perhaps there should be 2 constructors instead?

@nlewo
Copy link
Member

nlewo commented Nov 6, 2023

@RealOrangeOne I think we should keep a single constructor since we are supposed to remove the API_KEY method at some point: i don't think we should avoir introducing a new constructor to remove it in the future.

we still prompt for both values even though only one is used

Sorry, i don't understand what do you mean by "prompting both values". Is it the king library which prompt for both?

From my point of view, it would be good enough to fail in the constructor when both the API key and the PAT are empty strings (and displaying a help message suggesting to use a PAT).

@RealOrangeOne
Copy link
Contributor Author

we still prompt for both values

My point here was mostly that the constructor takes 2 values, even though we only use one. I like the idea of showing an error when both are provided - I think that covers the usability issues nicely.

cmd/gandi.go Outdated Show resolved Hide resolved
internal/client/gandi.go Outdated Show resolved Hide resolved
`token` should be the default
cmd/gandi.go Outdated Show resolved Hide resolved
internal/client/gandi.go Outdated Show resolved Hide resolved
@RealOrangeOne
Copy link
Contributor Author

@nlewo over to you!

internal/client/gandi.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
cmd/gandi.go Outdated Show resolved Hide resolved
RealOrangeOne and others added 2 commits November 21, 2023 08:34
Co-authored-by: lewo <lewo@abesis.fr>
This could be annoying to downstream users.
Copy link
Member

@nlewo nlewo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, i renamed Token to PersonalAccessToken

@nlewo nlewo merged commit 29df693 into go-gandi:master Nov 28, 2023
5 checks passed
@RealOrangeOne RealOrangeOne deleted the feature/support-personal-access-tokens branch November 28, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support personal access tokens
5 participants