Update injection of values to frontend
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
90346cefda
commit
a9e1baf7c3
|
@ -11,7 +11,7 @@ namespace ManagementPage.Database
|
||||||
private const string _accountsCollectionName = "Accounts";
|
private const string _accountsCollectionName = "Accounts";
|
||||||
private const string _deviceCollectionName = "Devices";
|
private const string _deviceCollectionName = "Devices";
|
||||||
private const string _databaseName = "Environment";
|
private const string _databaseName = "Environment";
|
||||||
private const string _uri = "mongodb://192.168.0.159:27017";
|
private readonly string _uri;
|
||||||
|
|
||||||
private readonly IMongoDatabase _database;
|
private readonly IMongoDatabase _database;
|
||||||
private readonly MongoClient _client;
|
private readonly MongoClient _client;
|
||||||
|
@ -20,8 +20,9 @@ namespace ManagementPage.Database
|
||||||
|
|
||||||
public IMongoCollection<DeviceData> DeviceCollection { get; private set; }
|
public IMongoCollection<DeviceData> DeviceCollection { get; private set; }
|
||||||
|
|
||||||
public MongoDbClient()
|
public MongoDbClient(IConfiguration configRoot)
|
||||||
{
|
{
|
||||||
|
_uri = configRoot["mongodb:uri"];
|
||||||
_client = new MongoClient(_uri);
|
_client = new MongoClient(_uri);
|
||||||
_database = _client.GetDatabase(_databaseName);
|
_database = _client.GetDatabase(_databaseName);
|
||||||
BsonClassMap.RegisterClassMap<EnvironmentData>(cm =>
|
BsonClassMap.RegisterClassMap<EnvironmentData>(cm =>
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
<RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
|
<RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
|
||||||
<RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
|
<RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
|
||||||
<NameOfLastUsedPublishProfile>P:\EnvironmentManagement\ManagementPage\ManagementPage\Properties\PublishProfiles\registry.jacknet.io.pubxml</NameOfLastUsedPublishProfile>
|
<NameOfLastUsedPublishProfile>P:\EnvironmentManagement\ManagementPage\ManagementPage\Properties\PublishProfiles\registry.jacknet.io.pubxml</NameOfLastUsedPublishProfile>
|
||||||
<ActiveDebugProfile>Docker</ActiveDebugProfile>
|
<ActiveDebugProfile>ManagementPage</ActiveDebugProfile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -3,7 +3,7 @@
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Error";
|
ViewData["Title"] = "Error";
|
||||||
}
|
}
|
||||||
|
<div style="font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif">
|
||||||
<h1 class="text-danger">Error.</h1>
|
<h1 class="text-danger">Error.</h1>
|
||||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
@ -13,14 +13,3 @@
|
||||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
<h3>Development Mode</h3>
|
|
||||||
<p>
|
|
||||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
|
||||||
It can result in displaying sensitive information from exceptions to end users.
|
|
||||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
|
||||||
and restarting the app.
|
|
||||||
</p>
|
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mongodb": {
|
||||||
|
"uri": "mongodb://192.168.0.159:27017"
|
||||||
|
},
|
||||||
"oidc": {
|
"oidc": {
|
||||||
"region": "openid-connect",
|
"region": "openid-connect",
|
||||||
"clientid": "51m0n-temperature",
|
"clientid": "51m0n-temperature",
|
||||||
|
|
|
@ -2,14 +2,31 @@ version: "3.4"
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
image: registry.jacknet.io/51m0n/environment-frontend:latest
|
image: registry.jacknet.io/51m0n/environment-frontend:latest
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_oidc_region=openid-connect
|
||||||
|
- ASPNETCORE_oidc_clientid=51m0n-temperature
|
||||||
|
- ASPNETCORE_oidc_clientsecret=
|
||||||
|
- ASPNETCORE_mongodb_uri=mongodb://database:27017/
|
||||||
|
|
||||||
database:
|
database:
|
||||||
image: mongodb:latest
|
image: mongo:latest
|
||||||
|
|
||||||
apiserver:
|
apiserver:
|
||||||
image: registry.jacknet.io/51m0n/environment-api:latest
|
image: registry.jacknet.io/51m0n/environment-api:latest
|
||||||
environment:
|
environment:
|
||||||
- GIN_DB_PATH=mongodb://database:27017
|
- GIN_DB_PATH=mongodb://database:27017/
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
|
||||||
proxy:
|
proxy:
|
||||||
image: nginx:latest
|
image: nginx:latest
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
ports:
|
||||||
|
- "9030:9000"
|
||||||
|
depends_on:
|
||||||
|
- apiserver
|
||||||
|
- frontend
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
# include /etc/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 9000;
|
||||||
|
listen [::]:9000;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
# To allow special characters in headers
|
||||||
|
ignore_invalid_headers off;
|
||||||
|
# Allow any size file to be uploaded.
|
||||||
|
# Set to a value such as 1000m; to restrict file size to a specific value
|
||||||
|
client_max_body_size 1m;
|
||||||
|
# To disable buffering
|
||||||
|
proxy_buffering off;
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_connect_timeout 300;
|
||||||
|
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
chunked_transfer_encoding off;
|
||||||
|
|
||||||
|
proxy_pass http://apiserver:8080/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_connect_timeout 300;
|
||||||
|
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
chunked_transfer_encoding off;
|
||||||
|
|
||||||
|
proxy_pass http://frontend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue