chore: read env vars from .env.local during dev

This commit is contained in:
Abdullah Atta
2022-12-30 19:23:39 +05:00
parent a789c5bb55
commit 9af8a46f87
6 changed files with 19 additions and 4 deletions

3
.gitignore vendored
View File

@@ -263,4 +263,5 @@ __pycache__/
keys/
dist/
appsettings.json
keystore/
keystore/
.env.local

10
.vscode/launch.json vendored
View File

@@ -15,7 +15,9 @@
"cwd": "${workspaceFolder}/Notesnook.API",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"MONGODB_CONNECTION_STRING": "mongodb://localhost:27017/notesnook",
"MONGODB_DATABASE_NAME": "notesnook"
}
},
{
@@ -29,7 +31,9 @@
"cwd": "${workspaceFolder}/Streetwriters.Identity",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"MONGODB_CONNECTION_STRING": "mongodb://localhost:27017/identity",
"MONGODB_DATABASE_NAME": "identity"
}
},
{
@@ -60,7 +64,7 @@
"configurations": [
"Launch Identity Server",
"Launch Messenger Server",
"Launch Notesnook.API Server",
"Launch Notesnook.API Server"
],
"preLaunchTask": ""
}

View File

@@ -33,6 +33,9 @@ namespace Notesnook.API
{
public static async Task Main(string[] args)
{
#if DEBUG
DotNetEnv.Env.TraversePath().Load(".env.local");
#endif
IHost host = CreateHostBuilder(args).Build();
await host.RunAsync();
}

View File

@@ -33,6 +33,9 @@ namespace Streetwriters.Identity
{
public static async Task Main(string[] args)
{
#if DEBUG
DotNetEnv.Env.TraversePath().Load(".env.local");
#endif
IHost host = CreateHostBuilder(args).Build();
await host.RunAsync();
}

View File

@@ -34,6 +34,9 @@ namespace Streetwriters.Messenger
{
public static void Main(string[] args)
{
#if DEBUG
DotNetEnv.Env.TraversePath().Load(".env.local");
#endif
CreateHostBuilder(args).Build().Run();
}

View File

@@ -9,6 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetEnv" Version="2.3.0" />
<PackageReference Include="Lib.AspNetCore.ServerSentEvents" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.0" NoWarn="NU1605" />