aboutsummaryrefslogtreecommitdiff
path: root/docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-12-19 12:39:37 +0800
committercrupest <crupest@outlook.com>2022-12-20 20:32:53 +0800
commit2d38b90f9b7f3297ada25b78a722b4e18fa8dc60 (patch)
tree58a41aafa68cee56f8d3eb8bb3dfdea46d28a703 /docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs
parente9b958cc41a3b941d878fd455e297a50e050be1a (diff)
downloadcrupest-2d38b90f9b7f3297ada25b78a722b4e18fa8dc60.tar.gz
crupest-2d38b90f9b7f3297ada25b78a722b4e18fa8dc60.tar.bz2
crupest-2d38b90f9b7f3297ada25b78a722b4e18fa8dc60.zip
Develop secret api. v44
Diffstat (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs')
-rw-r--r--docker/crupest-api/CrupestApi/CrupestApi.Commons/Secrets/SecretService.cs14
1 files changed, 13 insertions, 1 deletions
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<SecretInfo>, 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<string> GetPermissions(string secret)
{
var list = _table.Select<SecretInfo>(_dbConnection,