Simple API on .NET 6 to read MyVar and MyVar2 from environment variable.
For demo purpose, the API reads an SQL connection data from config file and environment variables and execute a query.
Reads the SQL from the appsettings.json file and environment variables.
"Database":{
"User": "sa",
"Password": "insecurepassword",
"Name": "TestDB",
"Server": "localhost"
}
To override the SQL connection, you can set the following environment variables:
DATABASE__USER=sa
DATABASE__PASSWORD=insecurepassword
DATABASE__NAME=TestDB
DATABASE__SERVER=localhost
{
"sqlConnection":"Data Source=localhost;Initial Catalog=DockerDatabase;User ID=sa;Password=insecurepassword;Multiple Active Result Sets=True;Connect Timeout=30",
"version":"v2"
}
Executes the SQL Query on configured Database (see /sql-connection section) and return results.
select * from sys.tables
Calls to external API and return results.
The Api Url is read from the appsettings.json file and environment variable APIURL
Returns the request IP address.