Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

.env.sh never works no matter what you add to it

Scheduled Pinned Locked Moved Solved Typebot
6 Posts 4 Posters 63 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CptPlasticC Offline
    CptPlasticC Offline
    CptPlastic
    wrote on last edited by
    #1

    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?

    girishG 1 Reply Last reply
    1
  • robiR Offline
    robiR Offline
    robi
    wrote on last edited by
    #2

    Might help to mention what the contents of your file look like and if you restart the app after the changes.

    Life of sky tech

    1 Reply Last reply
    0
  • girishG Offline
    girishG Offline
    girish Staff
    replied to CptPlastic on last edited by
    #3

    @CptPlastic Note that you need to add export x=y in files ending with .sh (that's the pattern we use in cloudron)

    CptPlasticC BrutalBirdieB 2 Replies Last reply
    3
  • CptPlasticC Offline
    CptPlasticC Offline
    CptPlastic
    replied to girish on last edited by
    #4

    @girish That works! I didn't even think about that. I'm going to update the documents with this note.

    Thank you

    1 Reply Last reply
    1
  • BrutalBirdieB Offline
    BrutalBirdieB Offline
    BrutalBirdie Staff
    replied to girish on last edited by
    #5

    @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#L49

    echo "==> 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#L23

    echo "=> Load .env"
    set -o allexport; source /app/data/.env; set +o allexport
    

    This way the .env file does not need export key=value but only key=value.
    😬
    Many ways lead to Rome, so maybe I should stick the default way. 😉

    Like my work? Consider donating a drink drink. Cheers!

    girishG 1 Reply Last reply
    1
  • girishG Offline
    girishG Offline
    girish Staff
    replied to BrutalBirdie on last edited by
    #6

    @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...

    1 Reply Last reply
    3
  • nebulonN nebulon marked this topic as a question on
  • nebulonN nebulon has marked this topic as solved on

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Login

  • Don't have an account? Register

  • Login or register to search.