Appsettings.json variable substitution 3 level hierarchy

I am trying to do some json variable substitution from Octopus into my appsettings.json following link everything looks easy till you have 3 level down.

Having this json {“app”: {“port”: “” }} and octopus’ variable app:port eq 8080 converts it to {“app”: {“port”: 8080}}.

However this doesn’t work when you have {“app”: {“server” : {“port”: “” }}} and octopus’ variable app:server:port eq 8080 you get {“app”: {“server” : {“port”: “” }}}

any idea ?

Hi @Alberto.acosta,

Thanks for getting in touch!

I’ve run a test on this and it does seem to be working as expected.

My JSON sample was:

"app": {
    "server": {
      "port": 8080
    }
  }

And my variable was defined as:

Following the deployment the value is successfully updated to 8000

  "app": {
    "server": {
      "port": 8000
    }
  }

I also tried it with a blank value initially, just in case it reacted differently, and that went through fine too.

What version of Octopus Server are you currently running? I can run a test on that version to see if it is an issue that has since been fixed.

Regards,
Paul

Hi Paul, it is solved I had some variables with period separators and other with colons, that seem to upset the transformation engine, I solved it changing all the variables to colons.

1 Like