Is it possible to use 'Octopus.Project.Name' as a Value in the Variable section?

I would like to set the Octopus.Project.Name as my DatabaseName in the Variable section so I do not have to hardcode it. Is this possible? If so, is there a certain syntax I need to use?

I am on version 2.4.4.43

Thank you,

Al

$OctopusProjectName works to output the project name, as does $OctopusParameters[“Octopus.Project.Name”]

The syntax above is the powershell syntax.

Within Octopus you reference variables using this syntax: #{VariableName}.

So in your case you would create a variable named DatabaseName and set the value to #{Octopus.Project.Name}.

You can also build up more complex strings such as creating a ConnectionString variable with the value Server=#{DatabaseServer};Database=#{Octopus.Project.Name},

You can see some more examples in the documentation section on variables.

The most useful part of this is that you can create a globally scoped variable like ConnectionString and then use restricted scope (e.g. Environment or Machine level) variables for sub-parts like DatabaseServer.