No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. mikael
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Groups 0

    mikael

    @mikael

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    mikael Follow

    Latest posts made by mikael

    • RE: SSR: How to insert environment variables from the server into rendered HTML or Javascript

      @mikael

      Ok I have managed to do it by:

      Step #1 add <script>document.API_BASE_URL = "{{{ API_BASE_URL }}}";</script> to index.template.html.

      Step #2 In a boot file add:

        if (ssrContext) {
          ssrContext.API_BASE_URL = process.env.API_BASE_URL;
          Vue.prototype.$API_BASE_URL = process.env.API_BASE_URL || 'http://localhost:7071/api';
        } else {
          Vue.prototype.$API_BASE_URL = document['API_BASE_URL'];
        }
      

      That seems to work but also seems very complicated, is there no simpler way of doing it?

      posted in Help
      M
      mikael
    • SSR: How to insert environment variables from the server into rendered HTML or Javascript

      Hi,

      I am deploying my SSR app on Azure AppService which uses environment variables to specify configuration settings.

      I am deploying my Quasar SSR project to several stages and they all point to different API endpoints, these API endpoints I would like to configure at “runtime” rather than inserting them using quasar build.

      However I cannot find a way to do it.

      For example in boot/axios.ts I added $Vue.prototype.$test = process.env.MY_VAR || 'smurf'; and the value of process.env.MY_VAR is correctly available for a few milliseconds (and I can render it into my <template>) but very quickly the client side version of boot/axios.ts is run and process.env.MY_VAR is now empty and my template is rerendered with the fallback.

      Also to clarify these values are not available so that I can check them into code, usually they are an output from an infrastructure deployment.

      Kind regards,

      Mikael

      posted in Help
      M
      mikael