-
Notifications
You must be signed in to change notification settings - Fork 170
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
Conversation
There was a problem hiding this 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:
- new(redis-cli): Add support for Redis CLI with password as environment variable and command-line flags #276
- new(mongosh): Support mongosh executable for connecting to a MongoDB database #283
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"), |
There was a problem hiding this comment.
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{ |
There was a problem hiding this comment.
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.
Name: credname.CLIToken, | ||
DocsURL: sdk.URL("https://appwrite.io/docs/command-line"), | ||
ManagementURL: sdk.URL("https://cloud.appwrite.io/"), | ||
Fields: []schema.CredentialField{ |
There was a problem hiding this comment.
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.
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 |
I think you meant to tag me, @Susmita-Dey :)
Could you clarify what you mean here? Appwrite CLI is a command line program to connect to the Appwrite server (there are many, and If you are able to get the shell plugin working, could you share step-by-step instructions on how to set it up (beyond Thanks! |
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. |
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? |
You may check this out:- https://appwrite.io/docs/command-line-commands |
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. |
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. |
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 😄 |
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. |
Overview
Add Appwrite shell plugin (work in progress)
Type of change
Related Issue(s)
How To Test
Install Appwrite CLI:- https://appwrite.io/docs/command-line
Test the plugin by running
Changelog