Conditional expression

Hi
I need two bindings in production and only one in test. So I added this expression to the “Enable”-field of the binding that is only needed in production:

#{if #{EnvironmentName}==“Production”}True#{/if}

But I get this error: “String was not recognized as a valid Boolean.”
What am I missing here?
Using Octopus 3.12.0

Hi @ah,

Thanks for getting in touch!

Could you provide a bit more detail (or screenshots) around where you are adding this condition? I’m unsure what you mean by bindings and the “Enable” field.

Regards,
Paul

Hi @paul.calvert
Sure here is a screen shot:

Ah ok, its for a IIS deployment step.
I’m not sure if that area is able to parse a conditional like that, you may be better using an environment scoped variable.

For example you could add a project variable BindingEnabled with value false and no scope and then another with the same name and value true for scope environment Production.
You can then place the variable in the Enabled field and it will automatically use the correct one based on the environment.

e.g.


I hope this helps, let me know how it works out for you.

Regards,
Paul

Thanks Paul, your example works out fine

1 Like

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