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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • 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
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. Postiz
  3. .env not taking effect?

.env not taking effect?

Scheduled Pinned Locked Moved Postiz
9 Posts 2 Posters 875 Views 2 Watching
  • 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.
  • B Offline
    B Offline
    badmonky
    wrote on last edited by
    #1

    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/1413958563579297892

    Just to clarify. Yes i did restart the cloudron app after editing the env file.

    1 Reply Last reply
    1
    • jamesJ Offline
      jamesJ Offline
      james
      Staff
      wrote on last edited by james
      #2

      Hello @badmonky

      The environment variables MAIN_URL, FRONTEND_URL and NEXT_PUBLIC_BACKEND_URL are set in the start.sh and can't be overwritten by the /app/data/env file.
      See https://git.cloudron.io/packages/postiz-app/-/blob/master/start.sh?ref_type=heads#L36-L38

      MAIN_URL="${CLOUDRON_APP_ORIGIN}"
      FRONTEND_URL="${CLOUDRON_APP_ORIGIN}"
      NEXT_PUBLIC_BACKEND_URL="${CLOUDRON_APP_ORIGIN}/api"
      
      1 Reply Last reply
      0
      • jamesJ Offline
        jamesJ Offline
        james
        Staff
        wrote on last edited by
        #3

        Maybe we should take a step back.
        Can you explain to me why you want to manually overwrite these variables?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          badmonky
          wrote on last edited by
          #4

          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/x

          with 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?

          jamesJ 1 Reply Last reply
          0
          • B badmonky

            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/x

            with 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?

            jamesJ Offline
            jamesJ Offline
            james
            Staff
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • jamesJ Offline
              jamesJ Offline
              james
              Staff
              wrote on last edited by
              #6

              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/env and restarting the app, I was able to login into my x.com account and create a post with no issue.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                badmonky
                wrote on last edited by
                #7

                I just uninstalled the postiz app, reinstalled it. Added the key and secret to /app/data/env and restarted.

                Still getting the exact same behavior as before.

                Any ideas how to troubleshoot this?

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  badmonky
                  wrote on last edited by
                  #8

                  As a side note. I think the info from this post should be added to the docs as well:
                  https://forum.cloudron.io/topic/13483/postiz-won-t-log-in-not-activated/2

                  1 Reply Last reply
                  2
                  • B Offline
                    B Offline
                    badmonky
                    wrote on last edited by
                    #9

                    Update:
                    I restarted the app again, and now it worked. I don't know what may have been the issue, but something seems to have a mind of it's own. 😄

                    1 Reply Last reply
                    2

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

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