From 7d5866a7658598466e33691f442f422e59577a34 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 19 Dec 2022 12:39:37 +0800 Subject: Develop secret api. v44 --- .../CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs') diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs index fc13707..4d9b14c 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs @@ -1,4 +1,3 @@ -using CrupestApi.Commons; using CrupestApi.Commons.Crud; namespace CrupestApi.Commons.Secrets; @@ -11,6 +10,19 @@ public class SecretService : CrudService, ISecretService } + protected override void DoInitializeDatabase(System.Data.IDbConnection connection) + { + base.DoInitializeDatabase(connection); + using var transaction = connection.BeginTransaction(); + _table.Insert(connection, new SecretInfo + { + Key = SecretsConstants.SecretManagementKey, + Secret = "crupest", + Description = "This is the init key. Please revoke it immediately after creating a new one." + }); + transaction.Commit(); + } + public List GetPermissions(string secret) { var list = _table.Select(_dbConnection, -- cgit v1.2.3