3 Replies Latest reply: May 23, 2017 1:40 AM by Erik Wetterberg RSS

    One mashup for two server nodes

    ido gridish

      hello,

       

      I have a mashup and two nodes,one central and on for usa.

       

      do i need to use two mashups? since each server (node) has its own url?

       

      thank.

       

      ido.

        • Re: One mashup for two server nodes
          Liron Baram

          Hi

          assuming your installation is Central and rim

          you can use the same mashup for the two servers ,

          a folder with the mashup is created in the extension folder

          so if you can use same extension on the same folder you should be able to use the same mashup

            • Re: One mashup for two server nodes
              ido gridish

              Hi liron,

              But i have two different url for each node and the mashup extention can hold only one url wrriten inside the mashup js.

               

              How can i make it work dynamicly so it doesnt matter from what url (server) i am connecting to the mashup it will work.

               

              Currently i can access the mashup from the central node that its url is hard coded in the script.

               

              Thanks.

                • Re: One mashup for two server nodes
                  Erik Wetterberg

                  Hi ido,

                  Try to avoid hard-coding the urls in your mashup, it is almost always possible, check out the mashup examples delivered with Qlik Sense for an example.

                   

                  In html files you can use relative links:

                   

                  <script src="../../resources/assets/external/requirejs/require.js"></script>  

                   

                     

                  In the javascript file you can use window.location:

                  var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);

                   


                  var config = {

                      host: window.location.hostname,

                      prefix: prefix,

                      port: window.location.port,

                      isSecure: window.location.protocol === "https:"

                  };


                  require.config({

                      baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"

                  });

                   

                  Hope this helps

                   

                  Erik Wetterberg