mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-08 10:44:20 -04:00
Add migration and generate auth secret
This commit is contained in:
parent
e898f49402
commit
7c3f4d3c20
@ -32,9 +32,8 @@ COMPOSE_PROFILES=cpu # cpu (no hardware acceleration) or vaapi or qsv or nvidia
|
|||||||
GOCODER_PRESET=fast
|
GOCODER_PRESET=fast
|
||||||
|
|
||||||
|
|
||||||
# The following two values should be set to a random sequence of characters.
|
# The following value should be set to a random sequence of characters.
|
||||||
# You MUST change thoses when installing kyoo (for security)
|
# You MUST change it when installing kyoo (for security)
|
||||||
AUTHENTICATION_SECRET="4c@mraGB!KRfF@kpS8739y9FcHemKxBsqqxLbdR?"
|
|
||||||
# You can input multiple api keys separated by a ,
|
# You can input multiple api keys separated by a ,
|
||||||
KYOO_APIKEYS=t7H5!@4iMNsAaSJQ49pat4jprJgTcF656if#J3
|
KYOO_APIKEYS=t7H5!@4iMNsAaSJQ49pat4jprJgTcF656if#J3
|
||||||
|
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
--project
|
--project
|
||||||
src/Kyoo.Postgresql
|
src/Kyoo.Postgresql
|
||||||
|
--msbuildprojectextensionspath
|
||||||
|
out/obj/Kyoo.Postgresql
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Authentication.Models;
|
using Kyoo.Authentication.Models;
|
||||||
@ -110,7 +109,8 @@ public static class AuthenticationModule
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
builder.Services.AddSingleton(options);
|
builder.Services.AddSingleton(options);
|
||||||
var secret = builder.Configuration.GetValue<byte[]>("AUTHENTICATION_SECRET")!;
|
|
||||||
|
byte[] secret = builder.Configuration.GetValue<byte[]>("AUTHENTICATION_SECRET")!;
|
||||||
builder.Services.AddSingleton(new AuthenticationOption() { Secret = secret });
|
builder.Services.AddSingleton(new AuthenticationOption() { Secret = secret });
|
||||||
|
|
||||||
builder
|
builder
|
||||||
|
@ -72,9 +72,11 @@ builder.Host.UseSerilog();
|
|||||||
|
|
||||||
builder.Services.ConfigureMvc();
|
builder.Services.ConfigureMvc();
|
||||||
builder.Services.ConfigureOpenApi();
|
builder.Services.ConfigureOpenApi();
|
||||||
|
|
||||||
|
// configure postgres first to allow other services to depend on db config
|
||||||
|
builder.ConfigurePostgres();
|
||||||
builder.ConfigureKyoo();
|
builder.ConfigureKyoo();
|
||||||
builder.ConfigureAuthentication();
|
builder.ConfigureAuthentication();
|
||||||
builder.ConfigurePostgres();
|
|
||||||
builder.ConfigureMeilisearch();
|
builder.ConfigureMeilisearch();
|
||||||
builder.ConfigureRabbitMq();
|
builder.ConfigureRabbitMq();
|
||||||
|
|
||||||
|
1395
back/src/Kyoo.Postgresql/Migrations/20240423151632_AddServerOptions.Designer.cs
generated
Normal file
1395
back/src/Kyoo.Postgresql/Migrations/20240423151632_AddServerOptions.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Kyoo.Postgresql.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddServerOptions : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "options",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
key = table.Column<string>(type: "text", nullable: false),
|
||||||
|
value = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_options", x => x.key);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
byte[] secret = new byte[128];
|
||||||
|
using var rng = RandomNumberGenerator.Create();
|
||||||
|
rng.GetBytes(secret);
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
"options",
|
||||||
|
new[] { "key", "value" },
|
||||||
|
new[] { "AUTHENTICATION_SECRET", Convert.ToBase64String(secret) }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(name: "options");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -688,6 +688,23 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
b.ToTable("users", (string)null);
|
b.ToTable("users", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ServerOption", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Key")
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasColumnName("key");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasColumnName("value");
|
||||||
|
|
||||||
|
b.HasKey("Key")
|
||||||
|
.HasName("pk_options");
|
||||||
|
|
||||||
|
b.ToTable("options", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("link_collection_movie", b =>
|
modelBuilder.Entity("link_collection_movie", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("collection_id")
|
b.Property<Guid>("collection_id")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user