Fix Restsharp / Move to Postgresql
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.Text;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;
|
||||
|
||||
namespace LaDOSE.Api;
|
||||
|
||||
public class NpgsqlSqlGenerationLowercaseHelper : NpgsqlSqlGenerationHelper
|
||||
{
|
||||
|
||||
static string ToLowerCase(string input) => input.ToLower();
|
||||
public NpgsqlSqlGenerationLowercaseHelper(RelationalSqlGenerationHelperDependencies dependencies)
|
||||
: base(dependencies) { }
|
||||
public override string DelimitIdentifier(string identifier)
|
||||
=> base.DelimitIdentifier(ToLowerCase(identifier));
|
||||
public override void DelimitIdentifier(StringBuilder builder, string identifier)
|
||||
=> base.DelimitIdentifier(builder, ToLowerCase(identifier));
|
||||
}
|
||||
@@ -15,8 +15,8 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,28 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LaDOSE.Business.Interface;
|
||||
using LaDOSE.Business.Provider;
|
||||
using LaDOSE.Business.Service;
|
||||
using LaDOSE.Entity;
|
||||
using LaDOSE.Entity.Context;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
//using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Pomelo.EntityFrameworkCore.MySql;
|
||||
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
|
||||
using AutoMapper;
|
||||
using LaDOSE.Api.Helpers;
|
||||
using LaDOSE.Business.Helper;
|
||||
@@ -32,6 +23,7 @@ using LaDOSE.Entity.Challonge;
|
||||
using LaDOSE.Entity.Wordpress;
|
||||
using Result = LaDOSE.Entity.Challonge.Result;
|
||||
using LaDOSE.Entity.BotEvent;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
|
||||
namespace LaDOSE.Api
|
||||
{
|
||||
@@ -82,9 +74,7 @@ namespace LaDOSE.Api
|
||||
// ));
|
||||
services.AddDbContextPool<LaDOSEDbContext>(options =>
|
||||
{
|
||||
options.UseMySql(
|
||||
$"Server={MySqlServer};Database={MySqlDatabase};User={MySqlUser};Password={MySqlPassword};",
|
||||
new MariaDbServerVersion(new Version(10, 1)));
|
||||
options.UseNpgsql(Configuration.GetConnectionString("DbContext")).ReplaceService<ISqlGenerationHelper,NpgsqlSqlGenerationLowercaseHelper>();
|
||||
});
|
||||
|
||||
var key = Encoding.ASCII.GetBytes(this.Configuration["JWTTokenSecret"]);
|
||||
|
||||
@@ -4,20 +4,24 @@
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DbContext":"Host=descartes.local;Username=tom;Password=tom;Database=ladoseapi"
|
||||
},
|
||||
"CertificateSettings": {
|
||||
"fileName": "localhost.pfx",
|
||||
"password": "YourSecurePassword"
|
||||
},
|
||||
"MySql": {
|
||||
"Server": "host",
|
||||
"Database": "database",
|
||||
"User": "User",
|
||||
"Password": "Password"
|
||||
"Server": "localhost",
|
||||
"Database": "ladoseapi",
|
||||
"User": "dev",
|
||||
"Password": "dev"
|
||||
},
|
||||
"ApiKey": {
|
||||
"ChallongeApiKey": "Challonge ApiKey"
|
||||
"ChallongeApiKey": "Challonge ApiKey",
|
||||
"SmashApiKey": "Smash"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"AllowedHosts": "0.0.0.0",
|
||||
"Port": 5000,
|
||||
"JWTTokenSecret": "here goes the custom Secret key for authnetication"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user