Skip to content

App to turn environment variables into a appsettings.json file

Notifications You must be signed in to change notification settings

MathiasFrost/Appsettings.FromEnv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Appsettings.FromEnv - V

App to turn environment variables into an appsettings.json file

Use case

Let's say you have a CRON job or a desktop application that requires secrets you don't want to commit to source control.
If you are deploying your app manually, there is no problem. You can just write your secrets in a secrets.json or appsettings.local.json locally.
But what if you want to use an automated CI/CD?
This app turns the environment variables you supply to the automated build and turn them into a JSON file your app can use in the build/publish stage.

Example

Supplied environment variables

ConnectionString=mariadb://root:1234@localhost:3306/my_schema
OpenId__ClientId=my_secret_client_id
OpenId__ClientSecret=1234567890

Run before build/publish

fromenv --vars ConnectionString OpenId__ClientSecret OpenId__ClientId

Resulting appsettings.local.json

{
	"OpenId": {
		"ClientId": "my_secret_client_id",
		"ClientSecret": "1234567890"
	},
	"ConnectionString": "mariadb://root:1234@localhost:3306/my_schema"
}

About

App to turn environment variables into a appsettings.json file

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages