Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

substitute variables in appsettings.json file

rajputj3@bv.com July 1, 2024

I have DONTNET code pipeline and I need to substitute variables from appsettings.json file.

Can you please give me an example?

This is part of my json file for dotnet core web app.

 

"ConnectionStrings": { "Redis": "" },

 

Thank you.

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 2, 2024

Hello rajputj3@bv.com ,

thank you for reaching out to the Community!

The way and syntax used to reference an environment variable very depends on the language/tools you are using, and not the the pipeline itself.

When you create an environment variable in your repository/workspace, this variable will be available to be referenced by any process during your build step, but the way and syntax used to reference variables is up to the language/tool you're using.

With that in mind, I'm not really familiar with the DotNet core variable syntax, but I found the following article that  may help you with the variable substitution on the appsettings.json :

In case that doesn't help, I would suggest reaching out directly to the DotNet community for additional suggestions on how the variable substitution works in that language/framework. 

Thank you, rajputj3@bv.com !
Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, ace, atlassian community event, donation, girls who code, women in tech, malala fund, plan international, kudos, community badge, badge, atlassian badge, International Women’s month, International Women’s Day, women's month, women's day

10 for Change at Atlassian Community Events

Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!

Join an Atlassian Community Event!
AUG Leaders

Upcoming Bitbucket Events