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 Appwrite shell plugin #306

Closed
wants to merge 4 commits into from
Closed

Add Appwrite shell plugin #306

wants to merge 4 commits into from

Conversation

Susmita-Dey
Copy link

@Susmita-Dey Susmita-Dey commented Jun 22, 2023

Overview

Add Appwrite shell plugin (work in progress)

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 Appwrite CLI:- https://appwrite.io/docs/command-line

Test the plugin by running

op plugin init appwrite

Changelog

@Susmita-Dey Susmita-Dey changed the title Add Appwrite plugin Add Appwrite shell plugin Jun 22, 2023
@Susmita-Dey Susmita-Dey marked this pull request as ready for review June 23, 2023 08:21
@arunsathiya arunsathiya self-requested a review June 23, 2023 18:08
@arunsathiya arunsathiya added the waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member label Jun 23, 2023
Copy link
Contributor

@arunsathiya arunsathiya left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution, @Susmita-Dey.

I am having some troubles getting this working though. The biggest issue is that the environment variables used in this plugin don't seem to work. Running a test command appwrite projects get --projectId 6495df658da7c618cab3 like just fails with the error ✗ Error Session not found. Please run appwrite login to create a session

That makes me wonder if the environment variables are actually valid. 🤔

In the case that environment variables are not supported, using the --key command line argument is an option, but the Shell Plugins project does not come with an arguments provisioner out of the box.

A custom provisioner could be built. Here are two other shell plugins that you could borrow the idea from:

Please give it a try and we are around if you have any questions along the way!

func CLIToken() schema.CredentialType {
return schema.CredentialType{
Name: credname.CLIToken,
DocsURL: sdk.URL("https://appwrite.io/docs/command-line"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a more specific documentation link that explains the credential itself, instead of the CLI itself as a whole?

}

// required fields
var defaultEnvVarMapping = map[string]sdk.FieldName{
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you help me with Appwrite's documentation on these environment variables? I am unable to locate it so far.

@arunsathiya arunsathiya 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 Jun 23, 2023
Name: credname.CLIToken,
DocsURL: sdk.URL("https://appwrite.io/docs/command-line"),
ManagementURL: sdk.URL("https://cloud.appwrite.io/"),
Fields: []schema.CredentialField{
Copy link
Contributor

Choose a reason for hiding this comment

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

If environment variables are supported somehow, could we also check if there's one for the Appwrite endpoint? It is a requirement for the appwrite CLI to communicate with the appwrite server, and it's prompted during my setup (without shell plugins) as well.

If we decide to go ahead with supporting the CI mode, let's make sure to create a field for the endpoint and provision it as a --endpoint command line argument.

@Susmita-Dey
Copy link
Author

Susmita-Dey commented Jun 24, 2023

Hey @arunsathiya This plugin only works for appwrite CLI as for that one needs to login. That's why it's asking for appwrite login. After you login, you can create a project, database, storage and everything. You can also access your project with project ID

@arunsathiya
Copy link
Contributor

I think you meant to tag me, @Susmita-Dey :)

This plugin only works for appwrite CLI as for that one needs to login

Could you clarify what you mean here? Appwrite CLI is a command line program to connect to the Appwrite server (there are many, and cloud.appwrite.io is the flagship instance).

If you are able to get the shell plugin working, could you share step-by-step instructions on how to set it up (beyond op plugin init appwrite) and screenshots of how it works for you? That may help gather additional specifics of how it's supposed to work.

Thanks!

@Susmita-Dey
Copy link
Author

Hey @arunsathiya Unfornatunately I can't show you the ss because it doesn't work on my Windows system. I don't have Mac or Linux.

@arunsathiya
Copy link
Contributor

Hi again, @Susmita-Dey! 👋🏼 I recommend setting up a Linux environment to build and test shell plugins on there. It's highly recommended (I'd even say required) to test the shell plugin because that helps validate that the proposed code is actually working.

In the current state, I am unable to get it working -- could you also help me with documentation links for Appwrite that indicate the proposed environment variables?

@Susmita-Dey
Copy link
Author

You may check this out:- https://appwrite.io/docs/command-line-commands

@edif2008 edif2008 added the hashnode hackathon Ideas and inspiration for the hackathon running from June 1st - June 30th label Jun 29, 2023
@arunsathiya
Copy link
Contributor

Thanks @Susmita-Dey, but I am not locating any references to APPWRITE_EMAIL or APPWRITE_PASSWORD on that documentation.

Could we take a step back -- could you clarify if these environment variables are actually used by the Appwrite CLI? Shell Plugins use the same environment variables that CLI programs use to provision secrets, rather than create new ones. So, could you identify if Appwrite uses environment variables at all, and if it does, make use of those variables for provisioning? My research so far indicates that it does not.

I could only find the CI mode to provision secrets using command line arguments. I'd propose that we take that approach, and you can build an arguments provisioner as seen previously on redis and mongoDB work:

Let me know if you have any questions along the way.

@techcraver
Copy link
Contributor

Hello! Don't forget to also write an accompanying blog post on Hashnode with the tags 1Password and BuildWith1Password (not just putting #1Password in the text - but use the Hashnode tags in the CMS. :)

The full instructions are here.

@hculea
Copy link
Member

hculea commented Jun 30, 2023

Since this is not yet ready for a code/functional review, I am going to be marking this as Draft.

@arunsathiya I would love if you could continue assisting here, to help Susmita get this to the finish line, even if after the hackathon deadline 😄

@hculea hculea marked this pull request as draft June 30, 2023 11:03
@hculea
Copy link
Member

hculea commented Jul 5, 2023

Hi Susmita, I wanted to touch base and see how your work is shaping up. We have another submission for Appwrite from Rajeev, and they proposed using the API_KEY environment variable for project-specific authentication. Is that something you have tried?

Since we have a more mature PR from Rajeev, we'll be closing the current PR but we welcome you to collaborate with Rajeev to learn how the API_KEY based authentication works.

@hculea hculea closed this Jul 5, 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.

5 participants