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

Add support for Contentful CLI #343

Closed
wants to merge 1 commit into from

Conversation

rajapri28613
Copy link
Contributor

Overview

Add support for Contentful CLI. The shell plugin provisions a configuration file at ~/.contentfulrc.json. The shell plugin also imports the Contentful token from the same file at the same path, if it exists.

Type of change

  • Created a new plugin
  • Improved an existing plugin
  • Fixed a bug in an existing plugin
  • Improved contributor utilities or experience

Related Issue(s)

  • Resolves: #
  • Relates: #

How To Test

  • Install Contentful CLI and set up shell plugin.
  • Future queries of contentful should provision the token at ~/.contentfulrc.json and use it for authentication.

Changelog

Add support for Contentful CLI.

Additional information

@rajapri28613
Copy link
Contributor Author

I have some problems with the test functions. I will fix them soon.

@rajapri28613
Copy link
Contributor Author

@arunsathiya arunsathiya added waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member hashnode hackathon Ideas and inspiration for the hackathon running from June 1st - June 30th labels Jul 3, 2023
Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution 💪 Looks great, only a few comments and questions!

type Config struct {
ManagementToken string `json:"managementToken"`
ActiveEnvironmentId string `json:"activeEnvironmentId"`
Host string `json:"host"`
Copy link
Member

Choose a reason for hiding this comment

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

Is the host something we could import from the json config file as well?

Copy link
Member

Choose a reason for hiding this comment

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

Similar question for ActiveEnvironmentId.

Comment on lines +39 to +41
Importer: importer.TryAll(
TryContentfulConfigFile(),
)}
Copy link
Member

Choose a reason for hiding this comment

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

Let's use TryContentfulConfigFile() directly, no need for TryAll if there is only one importer.

ActiveEnvironmentId: "master",
Host: "api.contentful.com",
}
contents, err := json.MarshalIndent(&config, "", " ")
Copy link
Member

Choose a reason for hiding this comment

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

No need for indentation, since this only produces a file meant to be consumed in a programmatic fashion. 😄

func TestPersonalAccessTokenProvisioner(t *testing.T) {
plugintest.TestProvisioner(t, PersonalAccessToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{
"default": {
ItemFields: map[sdk.FieldName]string{ // TODO: Check if this is correct
Copy link
Member

Choose a reason for hiding this comment

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

Should this TODO still be here?

Comment on lines +16 to +17
needsauth.NotForHelpOrVersion(),
needsauth.NotWithoutArgs(),
Copy link
Member

Choose a reason for hiding this comment

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

login and logout shouldn't authenticate either, I assume.

@hculea hculea self-requested a review July 5, 2023 07:30
@hculea
Copy link
Member

hculea commented Jul 7, 2023

Hey @rajapri28613 , I see there hasn't been any activity on this PR in a bit, is there anything that we can help you with?

We'd love to get this to the finish line together! 🚀

@accraw accraw added in-progress this PR is being worked on/comments are in the process of being addressed by the contributor and removed waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member labels Jul 14, 2023
@hculea
Copy link
Member

hculea commented Jul 25, 2023

Hey @rajapri28613 , reaching out here again! Would love to see this get to the finish line.

@hculea
Copy link
Member

hculea commented Sep 19, 2023

@rajapri28613 I am going to close this due to inactivity. Please do let us know if you'd like to pick this back up, would love to see this to the finish line!

@hculea hculea closed this Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashnode hackathon Ideas and inspiration for the hackathon running from June 1st - June 30th in-progress this PR is being worked on/comments are in the process of being addressed by the contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants