.env.sh never works no matter what you add to it
-
Im not sure why this happened im trying to hook up a google sheet however im not able to get the api key to work and I decided to add something simple like disable signup to the env.sh and it still is not working nor do I see the setting get pulled in via the logs even though it says its running env.sh.
Has anyone gotten the google sheets to work?
-
Might help to mention what the contents of your file look like and if you restart the app after the changes.
-
@CptPlastic Note that you need to add
export x=y
in files ending with .sh (that's the pattern we use in cloudron) -
@girish That works! I didn't even think about that. I'm going to update the documents with this note.
Thank you
-
@girish depends yes that is the default Cloudron way, but for example I did this in the Valheim Server app and the Greenlight app.
Greenlight:
https://git.cloudron.io/cloudron/greenlight-app/-/blob/master/start.sh#L49echo "==> Reading /app/data/.env" export $(grep -v '^#' /app/data/.env | xargs)
Valheim:
https://git.cloudron.io/cloudron/valheim-gameserver-app/-/blob/master/docker/app/code/start.sh#L23echo "=> Load .env" set -o allexport; source /app/data/.env; set +o allexport
This way the
.env
file does not needexport key=value
but onlykey=value
.
Many ways lead to Rome, so maybe I should stick the default way. -
@BrutalBirdie yes, I think that needs to be fixed. Obviously, nothing is right/wrong, but this is just a convention to guide people and makes support simpler. The convention is:
- If the app uses environment variables, just use
env.sh
pattern and expect people to add export keyword. A motivation for this is that in many app doc pages, they have export and people copy/paste it. - If the app uses .env , dotenv and other styles, just use env. Same rationale as above.
- Use dot files in /app/data only for package internal files. Do not use for app files. For example, it would be htaccess and not .htaccess if needed in /app/data/ . But, we use .initialized since it's a package thing and not related to the app.
Any deviation from above is mostly just oversight...
- If the app uses environment variables, just use
-
-
3/6