Connect with us


How to Handle Configuration for Multiple Environments in Console App Service? – Deployment Pipeline




Anna Kopteva Hacker Noon profile picture

@annakoptevaAnna Kopteva

I work as a Software Engineer in MTS Digital on the SSO project. Love programming and corgi!

Projects grow – sometimes faster than we expect. We know that manual work takes more time. I’ll show how I automated the service deployment process after issues caused by adding the test environment. Our team has developed a service for processing messages from Kafka. It is a console application that subscribes to topics, and when messages appear against each of them, a processing algorithm is executed.

During the first iterations, the deployment was quite simple: we publish the service locally, copy build files to the server, create a docker image, and start the service in a container.

We lived like this until the test team joined us and deployed in a testing environment. The appsettings.json configuration file in this environment was different. Therefore, we faced another chore – fixing the configuration file manually. At this stage, the human factor intervened; sometimes, we forgot to edit the file, which led to errors and loss of time.

When we got tired of it, we decided to call DevOps to help. However, it still took time. Therefore I came up with an idea and implemented a quick solution for handling multiple environments. Here are the details:

Initial Conditions

Our service is a console application, and we didn’t have out-of-the-box solutions as provided in the ASP.NET Core web application.

The application is launched from the docker container.

Setup Console App

Well, let’s see how to use multi-configuration in a console application. First, let’s create files for our environments Testing and development:

There is no default nesting in console applications. Therefore, open the .csproj project file and add:

<ItemGroup> <Content Include="appsettings.json"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="appsettings.Dev.json;appsettings.Testing.json;"> <DependentUpon>appsettings.json</DependentUpon> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content>

It looks much better, right? Afterward, I attach files with the name of the development environment that appeared in the appsettings.json file:

The appsettings.{Environment}.json contains parts of the config that change relative to the environment. For example, we change the name of the topics for Kafka in the load testing loop:

{ "Kafka": { "EventMainTopicTitle": "Test_EventMain", "EventDelayTopicTitle": "Test_EventDelay", "EventRejectTopicTitle": "Test_EventReject" }

Now, we just need to select the suitable appsettings.json file during the start of the service. To do this, let’s make changes to the program class:

/// <summary>
/// Service configuration
/// </summary>
private static IServiceProvider ConfigureServices ()
{ const string environmentVariableName = "ASPNETCORE_ENVIRONMENT"; var environmentName = Environment.GetEnvironmentVariable (environmentVariable name); var services = new ServiceCollection (); _configuration = new ConfigurationBuilder () .SetBasePath (Directory.GetParent (AppContext.BaseDirectory) .FullName) .AddJsonFile ("appsettings.json") .AddJsonFile ($ "appsettings. {EnvironmentName} .json") .AddEnvironmentVariables () .Build(); services.AddSingleton (_configuration); services.AddSingleton <KafkaHandler> (); return services.BuildServiceProvider ();

Setup Docker Container

Now everything is ready to start the service in a docker container.

First, you need to specify the environment variables for the container. There are several ways to do this:

  • command line
  • text file
  • docker compose

I settled on specifying the index in the string. Here’s an example script to create an image and run a container:

# Create image
# build docker. -t consoleapp

# Run container on Dev
# docker run -d --env ASPNETCORE_ENVIRONMENT = Dev --name app consoleapp


There are more elegant solutions for pipeline deployment. However, this solution can save time and human resources which are very critical in the early stages of building applications. 

Thanks for your attention and happy coding!

GitHub project:

Anna Kopteva Hacker Noon profile picture
by Anna Kopteva @annakopteva. I work as a Software Engineer in MTS Digital on the SSO project. Love programming and corgi!Read my stories


Join Hacker Noon

Create your free account to unlock your custom reading experience.

Coinsmart. Beste Bitcoin-Börse in Europa

Business Insider

George Soros Buys Millions’ Worth of Stocks Linked to Bill Hwang’s Archegos Collapse: Bloomberg




George Soros reportedly snapped up stocks that took a hit amid the collapse of Archegos Capital Management in March.

What Happened: Billionaire George Soros’ investment firm Soros Fund Management bought shares of CBS Corporation (NASDAQ:VIAC), DISCOVERY COMMUNICATIONS INC (NASDAQ:DISCA) and Baidu Inc (NASDAQ:BIDU) as these stocks were at a discount after Bill Hwang’s Archegos Capital Management collapsed, Bloomberg reports. 

Soros bought $194 million in ViacomCBS shares and $77 million in Baidu shares, the report said. The firm also bought $46 million worth of Vipshop Holdings Ltd (NYSE:VIPS) shares and $34 million of Tencent Music Entertainment Group’s (NYSE:TME) shares.

A person familiar with the fund’s trading told Bloomberg that the company didn’t hold the shares before Archegos’ implosion. 

Why It Matters: Hwang ran a family office that imploded in March and caused massive losses at a few big banks when Archegos couldn’t meet margin calls. Archegos had more than $20 billion of capital and total bets exceeding $100 billion.

Hwang was very successful with his family office until he began to overutilize leverage, or borrowed money, to chase higher returns in the market. The problem with this strategy comes when investments start to lose money, and the banks lending the investor money begin to get nervous and initiate margin calls.

Subsequently, shares of Archegos investments ViacomCBS, Discovery and others temporarily crashed during the Archegos unwinding.

Global banks lost nearly $10 billion from the Archegos fallout. Credit Suisse Group AG (NYSE:CS), Nomura Holdings Inc (TYO:8604) and Morgan Stanley (NYSE:MS) were among the hardest hit.

Image Credit: CC BY 2.5, Wikimedia Commons

Coinsmart. Beste Bitcoin-Börse in Europa

Continue Reading


How one founder’s startup journey began with dropping out of school to work with Drake




This week’s episode of Found features Courtne Smith, founder of NewNew, a social app where people pay to vote on your decisions. The platform takes the concept of social polling to the next level, essentially allowing everyone to monetize their choices by turning them into a kind of social stock market where others can purchase shares to accumulate more or less decision power based on what they’re willing to spend.

Courtne’s path to NewNew was immediately preceded by the creation of Surprize, a social trivia and prize-giving app that leveraged crowdsourcing to pick and award its prizes. But long before that, the Toronto native made a bold decision — encouraged by, of all people, her pastor father — to drop out of school and go work for Drake the very outset of his career as his personal assistant.

We talked to Courtne about making that risky deviation from a relatively traditional and safe path, and about how she eventually moved on from many years of working with Drake during his rise to global success: Another counterintuitive decision to go from something that was already working out well, to pursue something unknown. Courtne tells us about her overall entrepreneurial drive, which has always stemmed from a desire to create something game-changing, and about how when it came time to attract investors for her ventures, she opted not to leverage her deep-pocketed connections and instead sought capital on the merits of her ideas alone.

We had a great time chatting with Courtne, and we hope you have just as much fun listening. And of course, we’d love if you can subscribe to Found in Apple Podcasts, on Spotify, on Google Podcasts or in your podcast app of choice. Please leave us a review and let us know what you think, or send us direct feedback either on Twitter or via email. And please join us again next week for our next featured founder.

Coinsmart. Beste Bitcoin-Börse in Europa

Continue Reading


CBDCs Are Not That Stable And May Eventually Kill Bitcoin, Says Financial Expert




In early Sunday trading, BTC prices had fallen to their lowest levels for over 11 weeks, hitting $46,700 before a minor recovery.

The last time Bitcoin dropped to these levels was at the end of February during the second major correction of this ongoing rally. A rebound off that bottom sent prices above $60K for the first time in the two weeks that followed.

Later today, Bitcoin is going to close another weekly candle. In case the candle closes at those levels, this will become the worst weekly close since February 22nd, when BTC ended the week at $45,240, according to Bitstamp. Two weeks ago the weekly candle closed at $49,200, which the current lowest week close since February.

Second ‘Lower Low’ For Bitcoin

This time around, things feel slightly different and the bearish sentiment is returning to crypto-asset markets. Since its all-time high of $65K on April 14, Bitcoin has made a lower high and has now formed a second lower low on the daily chart, which is indicative of a larger downtrend developing.

Analyst ‘CryptoFibonacci’ has been eyeing the weekly chart which also suggests the bulls could be running out of steam.


The move appears to have been driven by Elon Musk again with a tweet about Bitcoin’s energy consumption on May 13. Bitcoin’s fear and greed index has dropped to 20 – ‘extreme fear’ – its lowest level since the March 2020 market crash. At the time of press, BTC was trading at just under $48,000, down 4% over the past 24 hours.

Market Cap Shrinks by $150B

As usual, the move has initiated a selloff for the majority of other cryptocurrencies resulting in around $150 billion exiting the markets over the past day or so.

The total market cap has declined to $2.3 trillion after an all-time high of $2.5 trillion on May 12. Things are still high on the long term view but losses could accelerate rapidly if the bearish sentiment increases.

Not all crypto assets are correcting this weekend, and some have been building on recent gains to push even higher – although they are few in number.

Those weekend warriors include Cardano which has added 4.8% on the day to trade at $2.27 according to Coingecko. ADA hit an all-time high on Saturday, May 15 reaching $2.36, a gain of 54% over the past 30 days.

Ripple’s XRP is also seeing a resurgence with a 13% pump on the day to flip Cardano for the fourth spot. XRP is currently trading at $1.58 with a market cap of $73 billion. The only other two cryptocurrencies in the green at the time of writing are Stellar and Solana, gaining 3.7% and 12% respectively.


Binance Futures 50 USDT FREE Voucher: Use this link to register & get 10% off fees and 50 USDT when trading 500 USDT (limited offer).

PrimeXBT Special Offer: Use this link to register & enter POTATO50 code to get 50% free bonus on any deposit up to 1 BTC.

You Might Also Like:

Coinsmart. Beste Bitcoin-Börse in Europa

Continue Reading

Business Insider

VIVO Clinic Unveils New Travel Information Portal




Leading PCR test provider VIVO Clinic has launched a travel information portal to assist with international trips to and from the UK.

BIRMINGHAM, England, May 16, 2021 /PRNewswire/ — During the pandemic, travel has been severely restricted. Now that the Government has launched a traffic light system designation for every country, UK residents are once again beginning to book holidays for the future.

The travel information portal is a comprehensive resource that provides relevant travel information in one place.

Travellers can browse countries based on the current traffic light designation and live popularity.

When viewing specific countries, travellers can see:

  • Which tests are required before, during, and after their trip
  • Current restrictions in that country
  • Weather, currency conversion, and time difference
  • Up to date Covid-19 statistics for that location
  • Flight and hotel availability

Commenting on the new system, Will Andrews, CTO at VIVO Clinic says: “International travel is set to bounce back in a big way, but understanding current restrictions and requirements can be confusing, and planning a trip can involve a time-consuming slog through many resources.”

The system automatically aggregates hundreds of data sources to provide information for 330 countries.

“We are incredibly proud of our travel information portal and hope that it will simplify international travel so customers can book trips confidently and safely.”

COVID-19 Advice for Travelling from the UK
0333 305 8486

Related Images

Covid-19 Travel Portal
Travel information portal on iPad

Coinsmart. Beste Bitcoin-Börse in Europa

Continue Reading
AI5 days ago

Build a cognitive search and a health knowledge graph using AWS AI services

Esports4 days ago

‘Destroy Sandcastles’ in Fortnite Locations Explained

Blockchain4 days ago

Shiba Inu: Know How to Buy the New Dogecoin Rival

Blockchain5 days ago

Meme Coins Craze Attracting Money Behind Fall of Bitcoin

Esports5 days ago

Valve launches Supporters Clubs, allows fans to directly support Dota Pro Circuit teams

Blockchain5 days ago

Sentiment Flippening: Why This Bitcoin Expert Doesn’t Own Ethereum

Blockchain4 days ago

Texas House Passes Bill that Recognizes Crypto Under Commercial Law

Aviation4 days ago

American Airlines Continues To Build Up Its Core Hub Strategy

Aviation5 days ago

Reuters: American Airlines adds stops to two flights after pipeline outage

ACN Newswire5 days ago

Duet Protocol closes first-round funding at US$3 million

Cyber Security5 days ago

Pending Data Protection and Security Laws At-A-Glance: APAC

AI5 days ago

Onestream: Data analysis, AI tools usage increased in 2021

Blockchain5 days ago

QAN Raises $2.1 Million in Venture Capital to Build DeFi Ecosystem

Blockchain4 days ago

Facebook’s Diem Enters Crypto Space With Diem USD Stablecoin

Business Insider5 days ago

Rally Expected To Stall For China Stock Market

Blockchain4 days ago


Esports4 days ago

Video: s1mple – MVP of DreamHack Masters Spring 2021

Business Insider4 days ago

HDI Announces Voting Results for Annual General and Special Meeting

AR/VR1 day ago

Next Dimension Podcast – Pico Neo 3, PSVR 2, HTC Vive Pro 2 & Vive Focus 3!

Esports4 days ago

TiMi Studios partners with Xbox Game Studios to bring a “new game sensory experience” to players