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
  • 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
W

webthingz

@webthingz
About
Posts
4
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Unable to Access Environment Variables in Vue.js App on Cloudron
    W webthingz

    Hello,

    I'm currently developing a Vue.js application and deploying it on Cloudron. I'm trying to access an environment variable (VUE_APP_DIRECTUS_TOKEN) in my Vue.js component, but it always returns undefined.

    Here's the relevant part of my code:

    methods: {
      async register() {
        try {
          await axios.post(
            'https://directus.example.com',
            {
              email: this.email,
              password: this.password,
              status: 'active'
            },
            {
              headers: {
                Authorization: `Bearer ${import.meta.env.VUE_APP_DIRECTUS_TOKEN}`
              }
            }
          )
          alert('Registration successful')
        } catch (error) {
          alert('Registration failed: ' + error.message)
        }
      }
    }
    

    I've tried setting the environment variable in a .env file in the root of my project, and also in an env.sh file in the /app/data/ directory as suggested by Cloudron's documentation. I've also tried using the export keyword. However, none of these methods seem to work.

    Here's how I've set the environment variable:

    export VUE_APP_DIRECTUS_TOKEN=my_token_here
    

    Sure, here's a draft for your forum question:


    Title: Unable to Access Environment Variables in Vue.js App on Cloudron

    Body:

    Hello,

    I'm currently developing a Vue.js application and deploying it on Cloudron. I'm trying to access an environment variable (VUE_APP_DIRECTUS_TOKEN) in my Vue.js component, but it always returns undefined.

    Here's the relevant part of my code:

    methods: {
      async register() {
        try {
          await axios.post(
            'https://wij.metaalkathedraal.nl/users',
            {
              email: this.email,
              password: this.password,
              status: 'active'
            },
            {
              headers: {
                Authorization: `Bearer ${import.meta.env.VUE_APP_DIRECTUS_TOKEN}`
              }
            }
          )
          alert('Registration successful')
        } catch (error) {
          alert('Registration failed: ' + error.message)
        }
      }
    }
    

    I've tried setting the environment variable in a .env file in the root of my project, and also in an env.sh file in the /app/data/ directory as suggested by Cloudron's documentation. I've also tried using the export keyword. However, none of these methods seem to work.

    Here's how I've set the environment variable:

    export VUE_APP_DIRECTUS_TOKEN=your_token_here
    

    I've made sure to restart the app after making changes to the environment variables.

    I'm able to hardcode the token directly into the code and it works, so the issue seems to be with loading the environment variable.

    Does anyone have any suggestions on how to correctly set and access environment variables in a Vue.js app on Cloudron?

    Thank you in advance for your help.

    Directus

  • Restore cloudron with multiple volumes on a new server
    W webthingz

    Hello There,

    I'm planning on moving a Cloudron server to another provider. At the moment there are only 4 important apps on it but I have 3 extra volumes connected to cloudron with ext4. How will this work when you move the complete server, do you need 1 big volume at first? I really want to move the apps one by one. But is there a way to transfer the license? Can't find a manual to do that.
    Or I could disconnect the license but because you only can have 2 apps without a license, what happens with the apps above 2..
    Is there like a grace period so I can move the apps above the 2 default apps?

    Not sure what is best practice. I hope there is a way to just activate the license after installing that would help me a lot.

    --> When you click on setup again you disconnect the license. Will this brake all apps above 2?
    894b25eb-15af-4dff-87cc-60b2518ae1cb-image.png

    Support restore
  • Login

  • Don't have an account? Register

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