put in fixed error in appsetting.cs does not have other key

This commit is contained in:
2026-05-13 18:22:17 +10:00
parent fb751ecbc3
commit c0bc89083d
5 changed files with 46 additions and 38 deletions
+2 -2
View File
@@ -4,9 +4,9 @@ public class AppSettings
{
public string Secret { get; set; }
public string SQLConnectionString { get; set; }
public string LoginWebAPI { get; set; }
public string ImageFolder { get; set; }
public string ClientURL { get; set; }
public string ImportFolder { get; set; }
}
/*
+10 -1
View File
@@ -24,9 +24,18 @@ services.AddEndpointsApiExplorer();
services.AddSwaggerGen();
var appSettingsSection = builder.Configuration.GetSection("AppSettings");
string skey = "";
if (appSettingsSection == null)
{
skey = builder.Configuration.GetValue<string>("AppSettings:SecretKey");
}
else
{
services.Configure<AppSettings>(appSettingsSection);
var appSettings = appSettingsSection.Get<AppSettings>();
var key = Encoding.ASCII.GetBytes(appSettings.Secret);
skey = appSettings.Secret;
}
var key = Encoding.ASCII.GetBytes(skey);
services.AddAuthentication(x =>
{
@@ -146,7 +146,7 @@ public class UserServiceRepository : IUserService
AuthenticateResponse retval = null;
string error = "user name is not in DB or user Name profile is not generic";
int statuscode = 0;
string webAPIUrl = _appSettings.LoginWebAPI;
string webAPIUrl = "_appSettings.LoginWebAPI";
//KCO, D204KCO
//now check the adminuser table
//ward clerk
+1 -1
View File
@@ -2,7 +2,7 @@
Description=ASP.NET Core Web App running on Ubuntu
[Service]
WorkingDirectory=/var/www/familytree/api
ExecStart=/usr/bin/dotnet /var/www/fadmilytree/api/FamilyTreeAPI.dll
ExecStart=/usr/bin/dotnet /var/www/familytree/api/FamilyTreeAPI.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
+6 -7
View File
@@ -1,10 +1,7 @@
#make sure in nginx.conf has include module.d/*.conf inside http block one.
server {
listen 80;
server_name://yourdomain.com # your actaul subdomain
#root /var/www/familytree/familytreeui; #path to your build files
#index index.html
listen 80; #make nginx out side listen 82;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
@@ -21,6 +18,8 @@ server {
index index.html
try_files $uri $uri/ /index.html;
}
# Optional: Cache static assets for better performance
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
@@ -28,8 +27,8 @@ server {
}
error_page 404 /index.html;
}
# put in /etc/nginx/sites-availalble/familytreeapp.conf
# link to enable
# $) sudo ln -s /etc/nginx/sites-availalble/familytreeapp.conf /etc/nginx/sites-enabled/
}