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 | 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 41 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 Online
    B Online
    badmonky
    wrote 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 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 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 Online
          B Online
          badmonky
          wrote 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 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 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 Online
                B Online
                badmonky
                wrote 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 Online
                  B Online
                  badmonky
                  wrote 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 Online
                    B Online
                    badmonky
                    wrote 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
                    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