Empty space for Structured Configuration Variables

I’m updating a deployment from .Net 4.8 to .Net 6, so the app.config has been replaced with appsettings.json.

I have one project variable specified as an empty string- Octopus inserts that as in the app.config file, however in the appsettings.json file I’m getting “override”: null

What can I do to get an empty string: “override”: “”?

Hi @seanl,

Thank you for reaching out, and sorry to hear you are having trouble with empty structured configuration variables within your deployment process, but I would be happy to help take a closer look at things!

As an initial step, I found this really great forum post by one of my colleagues that seems to speak to the same use case, so I wanted to link this for your reference/review (in case you hadn’t come across this yet):

Patrick covers a few different ways to handle this scenario, so hopefully one of these approaches will work for your needs - in the case of the original poster, it looks like the second option ended up working well for them:

null or "" works with our SMTP just not "null" so from our end, we are sorted using Option 2

I hope this initial information helps in getting your process adjusted to account for this situation, but let me know how it goes in testing on your side.

Regards,

Britton

So, null = “” and “” = null in the json structured config files?

Setting the variable to null did set the config value to “”, so thanks.

Is this behavior likely to be addressed as a bug?

Hi @seanl,

Thank you for the update, and I’m happy to hear you were able to get things going!

The behavior here does seem a little unintuitive, so I’ve reached out to our development team for clarification on the expected functionality for null and "" values when using the JSON structured configuration variables feature, and hopefully they can shed some light on this and whether or not it should be considered a bug in how this substitution currently works.

Thanks for your patience while I wait to hear back from the team on this, and let me know if I can be of any other help in the meantime.

Regards,

Britton

Hi @seanl,

Just stepping in for Britton with an update from the devs.

They are looking into ways to best accomodate this and it seems like there could be add an additional variable filter for setting null values using our Octostache library to provide a filter for the replacement.

E.g.

#{ | null}

I’ve created a Github issue for tracking this new feature here: Octostache Enhancement - Add filter for setting value to null · Issue #8232 · OctopusDeploy/Issues · GitHub

Hope that helps but feel free to reach out with any questions at all!

Best Regards,

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.