.env not taking effect?
-
I am at my wits end. Installed, updated the env file for X (setup x app as well).
But its not working. From what i can tell it looks like the env vars are not taking effect.
E.g. i still have /api/ in the NEXT_PUBLIC_BACKEND_URL as set in the start.sh
NEXT_PUBLIC_BACKEND_URL="${CLOUDRON_APP_ORIGIN}/api"
I overwrote them in my env file
MAIN_URL="https://postiz.mydomain.com"
FRONTEND_URL="https://postiz.mydomain.com"
NEXT_PUBLIC_BACKEND_URL="https://postiz.mydomain.com"But in the network tab, i see it trying to hit /api in the Request URL
Also, based on this discord chat on postiz I assume the /api is outdated?
https://discord.com/channels/1243410146097500202/1413958563579297892/1413958563579297892Just to clarify. Yes i did restart the cloudron app after editing the env file.
-
Hello @badmonky
The environment variables
MAIN_URL,FRONTEND_URLandNEXT_PUBLIC_BACKEND_URLare set in thestart.shand can't be overwritten by the/app/data/envfile.
See https://git.cloudron.io/packages/postiz-app/-/blob/master/start.sh?ref_type=heads#L36-L38MAIN_URL="${CLOUDRON_APP_ORIGIN}" FRONTEND_URL="${CLOUDRON_APP_ORIGIN}" NEXT_PUBLIC_BACKEND_URL="${CLOUDRON_APP_ORIGIN}/api" -
Because thats what the dicsord conversation said (i realize they don't use cloudron).
The issue is that i cannot add the x channel. The UI does not give any helpful errors other than a "could not connect to the platform" popup for 2sec.
When i look at the network tab, i get the above mentioned request made to
https://postiz.mydomain.com/api/integrations/social/xwith response: {"err":true}
thats how i got to suspect that the /api is the issue.
If i am however on the wrong track. then let me know what else i could try.
that said. If I can't overwrite the env file, then the docs are wrong i guess? (https://docs.cloudron.io/packages/postiz/#customization), and how am I going to add the API keys for the providers?
-
Because thats what the dicsord conversation said (i realize they don't use cloudron).
The issue is that i cannot add the x channel. The UI does not give any helpful errors other than a "could not connect to the platform" popup for 2sec.
When i look at the network tab, i get the above mentioned request made to
https://postiz.mydomain.com/api/integrations/social/xwith response: {"err":true}
thats how i got to suspect that the /api is the issue.
If i am however on the wrong track. then let me know what else i could try.
that said. If I can't overwrite the env file, then the docs are wrong i guess? (https://docs.cloudron.io/packages/postiz/#customization), and how am I going to add the API keys for the providers?
Hello @badmonky
@badmonky said in .env not taking effect?:
If I can't overwrite the env file, then the docs are wrong i guess?
No. Cloudron has to do hard overwrite certain environment variables to ensure the functionality of apps.
I will update the docs to better explain it. -
Hello @badmonky
The documentation will be updated today.
I have tried to reproduce your issue.
Installed Postiz from the Cloudron app store and after following the guide for X https://docs.postiz.com/providers/x-twitter and adding:X_API_KEY="myApiKey" X_API_SECRET="MyApiSecret"to
/app/data/envand restarting the app, I was able to login into my x.com account and create a post with no issue.