Back

[Solved]How can I get events set on cloud to my local functions

  • 0
  • Web
  • Cloud
Ajit Singh
4 Jun, 2023, 13:42

If I do appwrite functions deploy it overwrites the settings on cloud if I do appwrite functions update then also it overwrites the events set in cloud dashboard. How can I create a function in cloud and then pull all the settings of that function of cloud to my local where I can write the function with appwritecli

TL;DR
The user has a question about how to get events set on the cloud to their local functions. Several users suggest using a script to update the relevant files and switch between them. One user provides a link to a script for switching between multiple prefs.json files. Another user suggests having separate appwrite.json files for local and production environments. However, there is no direct solution mentioned for pulling all the settings of a function from the cloud to the local environment using appwritecli.
mitsy0_0
4 Jun, 2023, 15:38

I think there is no such feature as pulling the settings, as of now

mitsy0_0
4 Jun, 2023, 15:38

you have to add the corresponding code manually

Binyamin
4 Jun, 2023, 15:49

Correct, As of now it's a one way road.

Guille
4 Jun, 2023, 15:49

You can have two appwrite.json files one for local and other for production.

To switch between local and cloud is a little akward at the moment as you have to change the CLI settings a follows each time:

TypeScript
appwrite client --endpoint https://cloud.appwrite.io/v1
appwrite client --key 23f24gwrhSDgefaY
appwrite client --selfSigned true
appwrite client --reset // Resets your CLI configuration
appwrite client --debug // Prints your current configuration
Drake
4 Jun, 2023, 16:28

I have multiple prefs.json and use this to switch between them: https://gist.github.com/stnguyen90/65315e1ac6a5530d30fd108030464a64

Binyamin
4 Jun, 2023, 16:28

Nice πŸ‘

Guille
4 Jun, 2023, 16:45

That is so nice! I'll try it! thank you!

Ajit Singh
5 Jun, 2023, 03:20

Thanks I'll try that

Ajit Singh
5 Jun, 2023, 13:19

[Solved]How can I get events set on cloud to my local functions

Guille
5 Jun, 2023, 16:30

Hey @Steven I'm trying to use your script, I just have a doubt: when you run: ~/.appwrite/use.sh <domain.json> you copy the content of domain.json file to pref.json?

I mean what is the wokflow to use the script?

Drake
5 Jun, 2023, 16:34

prefs.json is a symlink to domain.json. the script updates the symlink to point to a different domain.json

Guille
5 Jun, 2023, 16:37

So, should I edit domain.json with the information for that domain and then switch?

Drake
5 Jun, 2023, 16:39

just make sure you have a domain.json with at least {}, then switch, and then appwrite login will update the domain.json with the relevant data

Guille
5 Jun, 2023, 16:44

I'll test it now, thanks again!

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more