Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Tor Langlo 151 posts 399 karma points
    Nov 05, 2018 @ 16:22
    Tor Langlo

    How can I specify different configuration for the back office based on cloud instance/site?

    In my back office I have a custom property editor which accesses another web site's web api. I have a need to vary the url for this other web site based on which cloud site I'm on (local, dev, or live). How can I do this?

    I have already specified the url's in my web.config, web.development.xdt.config, and Is there a way to transfer this information from the server side to the client side back office?


  • Niels Hartvig 1950 posts 2389 karma points admin hq c-trib
    Nov 05, 2018 @ 16:39
    Niels Hartvig

    Hi Tor!

    Config transforms are your friend. There's documentation and videos about that feature here:

    Hope this helps!


  • Tor Langlo 151 posts 399 karma points
    Nov 05, 2018 @ 18:43
    Tor Langlo

    Hi Niels,

    I've got the config transforms under control, and it's working well in the back-end of my "front-end" site. And I'm passing the config data (the url) to my client side javascript code via Razor.

    The challenge is the client-side Angular code for the back-office custom property editor. How can I replace the "domain" string literal in the code snippet below with values from web.config (or somewhere else)?

      .controller('productid.editorcontroller', function($scope, $http) {
        $ = function(id) {
          var domain = '';
          var url = domain + '/api/products/' + id;
              function onSuccess(response) {
              function onError(response) {
  • Nik 1304 posts 5550 karma points MVP 3x c-trib
    Nov 05, 2018 @ 19:01

    Hey Tor,

    I wrote a post about something that might help with this.

    Umbraco provides access to something called Umbraco.Sys.Variables in angular which you can hook into during some of the startup events. In there you can add your own behaviour and as a result you might be able to put in the base URL of your API end point. Have a read, it might help :-) You could use the premise to read the domain from an AppSetting populated by a config transform.


  • Tor Langlo 151 posts 399 karma points
    Nov 05, 2018 @ 21:28
    Tor Langlo

    Thanks Nik! I'll definitely look into this.


Please Sign in or register to post replies

Write your reply to: