Skip to content

Commit 8b90e77

Browse files
author
agile.zhou
committed
Merge branch 'master' into publish
2 parents 32fd604 + 631ebe3 commit 8b90e77

13 files changed

Lines changed: 391 additions & 65 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818

1919

2020

21-
# [English](https://github.com/kklldog/AgileConfig/blob/master/README_EN.md) | [中文看这里](https://github.com/kklldog/AgileConfig/blob/master/README_CN.md)
21+
# [English](https://github.com/dotnetcore/AgileConfig/blob/master/README_EN.md) | [中文看这里](https://github.com/dotnetcore/AgileConfig/blob/master/README_CN.md)
2222

2323
This is a lightweight configuration center based on .net core . It is easy to deploy , easy to learn , easy to use .
24+
25+
CN Atomgit Mirror site: [AgileConfig](https://atomgit.com/dotnetcore/AgileConfig)
26+
2427
## 😍Features
2528
1. easy to deploy (docker or IIS)
2629
2. support distributed deploy

README_CN.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99

1010
[![Member project of .NET Core Community](https://img.shields.io/badge/member%20project%20of-NCC-9e20c9.svg)](https://github.com/dotnetcore)
1111
[![package workflow](https://github.com/dotnetcore/AgileConfig/actions/workflows/release-xxx.yml/badge.svg)](https://github.com/dotnetcore/AgileConfig/actions/workflows/release-xxx.yml)
12-
![GitHub stars](https://img.shields.io/github/stars/kklldog/AgileConfig)
13-
![Commit Date](https://img.shields.io/github/last-commit/kklldog/AgileConfig/master.svg?logo=github&logoColor=green&label=commit)
12+
![GitHub stars](https://img.shields.io/github/stars/dotnetcore/AgileConfig)
13+
![Commit Date](https://img.shields.io/github/last-commit/dotnetcore/AgileConfig/master.svg?logo=github&logoColor=green&label=commit)
1414
![Nuget](https://img.shields.io/nuget/v/agileconfig.client?label=agileconfig.client)
1515
![Nuget](https://img.shields.io/nuget/dt/agileconfig.client?label=client%20download)
1616
![Docker image](https://img.shields.io/docker/v/kklldog/agile_config?label=docker%20image)
17-
![GitHub license](https://img.shields.io/github/license/kklldog/AgileConfig)
17+
![GitHub license](https://img.shields.io/github/license/dotnetcore/AgileConfig)
1818
![build workflow](https://github.com/dotnetcore/AgileConfig/actions/workflows/master-ci.yml/badge.svg)
1919

20-
# [English](https://github.com/kklldog/AgileConfig/blob/master/README_EN.md) | [中文看这里](https://github.com/kklldog/AgileConfig/blob/master/README.md)
20+
# [English](https://github.com/dotnetcore/AgileConfig/blob/master/README_EN.md) | [中文看这里](https://github.com/dotnetcore/AgileConfig/blob/master/README.md)
2121

2222
这是一个基于.net core开发的轻量级配置中心。说起配置中心很容易让人跟微服务联系起来,如果你选择微服务架构,那么几乎逃不了需要一个配置中心。事实上我这里并不是要蹭微服务的热度。这个世界上有很多分布式程序但它并不是微服务。比如有很多传统的SOA的应用他们分布式部署,但并不是完整的微服务架构。这些程序由于分散在多个服务器上所以更改配置很困难。又或者某些程序即使不是分布式部署的,但是他们采用了容器化部署,他们修改配置同样很费劲。所以我开发AgileConfig并不是为了什么微服务,我更多的是为了那些分布式、容器化部署的应用能够更加简单的读取、修改配置。
2323
AgileConfig秉承轻量化的特点,部署简单、配置简单、使用简单、学习简单,它只提取了必要的一些功能,并没有像Apollo那样复杂且庞大。但是它的功能也已经足够你替换webconfig,appsettings.json这些文件了。如果你不想用微服务全家桶,不想为了部署一个配置中心而需要看N篇教程跟几台服务器那么你可以试试AgileConfig :)
2424

25-
Gitee 仓库镜像(不定时更新):[https://gitee.com/kklldog/AgileConfig](https://gitee.com/kklldog/AgileConfig)
25+
国内 Atomgit 托管: [AgileConfig](https://atomgit.com/dotnetcore/AgileConfig)
2626

2727
💖💖 镜像拉不下来的看这:
2828
由于众所周知的原因,最近在国内很难从 docker hub 上拉取镜像,所以在 aliyun 上做了一个公共的仓库:

README_EN.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
[![Member project of .NET Core Community](https://img.shields.io/badge/member%20project%20of-NCC-9e20c9.svg)](https://github.com/dotnetcore)
1010
[![package workflow](https://github.com/dotnetcore/AgileConfig/actions/workflows/release-xxx.yml/badge.svg)](https://github.com/dotnetcore/AgileConfig/actions/workflows/release-xxx.yml)
11-
![GitHub stars](https://img.shields.io/github/stars/kklldog/AgileConfig)
11+
![GitHub stars](https://img.shields.io/github/stars/dotnetcore/AgileConfig)
1212
![Commit Date](https://img.shields.io/github/last-commit/kklldog/AgileConfig/master.svg?logo=github&logoColor=green&label=commit)
1313
![Nuget](https://img.shields.io/nuget/v/agileconfig.client?label=agileconfig.client)
1414
![Nuget](https://img.shields.io/nuget/dt/agileconfig.client?label=client%20download)
@@ -21,6 +21,9 @@
2121
# [English](https://github.com/kklldog/AgileConfig/blob/master/README_EN.md) | [中文看这里](https://github.com/kklldog/AgileConfig/blob/master/README_CN.md)
2222

2323
This is a lightweight configuration center based on .net core . It is easy to deploy , easy to learn , easy to use .
24+
25+
CN Atomgit Mirror site: [AgileConfig](https://atomgit.com/dotnetcore/AgileConfig)
26+
2427
## 😍Features
2528
1. easy to deploy (docker or IIS)
2629
2. support distributed deploy

src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
6-
<AssemblyVersion>1.12.0</AssemblyVersion>
7-
<Version>1.12.0</Version>
8-
<PackageVersion>1.12.0</PackageVersion>
6+
<AssemblyVersion>1.12.1</AssemblyVersion>
7+
<Version>1.12.1</Version>
8+
<PackageVersion>1.12.1</PackageVersion>
99
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
10-
<FileVersion>1.12.0</FileVersion>
10+
<FileVersion>1.12.1</FileVersion>
1111
<Authors>kklldog</Authors>
1212
<Company>kklldog</Company>
1313
</PropertyGroup>

src/AgileConfig.Server.Apisite/Filters/PermissionCheckByBasicAttribute.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public PermissionCheckByBasicAttribute(
1919
IConfigService configService,
2020
IAdmBasicAuthService basicAuthService,
2121
IUserService userService,
22-
string actionName,
2322
string functionKey) : base(permissionService, configService, functionKey)
2423
{
2524
_userService = userService;

src/AgileConfig.Server.Apisite/InitService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public async Task StartAsync(CancellationToken cancellationToken)
4343
if (Appsettings.IsAdminConsoleMode)
4444
{
4545
_systemInitializationService.TryInitJwtSecret(); // Initialize the JWT secret.
46+
await _systemInitializationService
47+
.TryInitSystemRolesAndPermissions(); // Initialize system roles, functions and permission bindings.
4648
_systemInitializationService.TryInitSaPassword(); // init super admin password
4749
_systemInitializationService.TryInitDefaultApp();
48-
await _systemInitializationService
49-
.TryInitSuperAdminRole(); // Initialize SuperAdministrator role and functions
5050
_ = _remoteServerNodeProxy.TestEchoAsync(); // Start node connectivity checks.
5151
_ = _serviceHealthCheckService.StartCheckAsync(); // Start service health monitoring.
5252
_eventRegister.Register(); // Register event bus callbacks.

src/AgileConfig.Server.Data.Abstraction/ISysInitRepository.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@ public interface ISysInitRepository
3232
bool HasSa();
3333

3434
bool InitDefaultApp(string appName);
35+
36+
/// <summary>
37+
/// Ensure the built-in system roles and their function permission bindings exist and stay in sync.
38+
/// Idempotent: safe to call on every startup without creating duplicate bindings.
39+
/// </summary>
40+
void EnsureSystemRolePermissions();
3541
}

src/AgileConfig.Server.Data.Repository.Freesql/SysInitRepository.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public bool InitSa(string password)
4545

4646
var sql = freeSqlFactory.Create();
4747

48-
EnsureSystemRoles(sql);
49-
5048
var user = new User();
5149
user.Id = SystemSettings.SuperAdminId;
5250
user.Password = password;
@@ -103,6 +101,12 @@ public bool InitDefaultApp(string appName)
103101
return true;
104102
}
105103

104+
public void EnsureSystemRolePermissions()
105+
{
106+
var sql = freeSqlFactory.Create();
107+
EnsureSystemRoles(sql);
108+
}
109+
106110
private static void EnsureSystemRoles(IFreeSql sql)
107111
{
108112
// Super Admin gets all permissions

src/AgileConfig.Server.Data.Repository.Mongodb/SysInitRepository.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ public bool InitSa(string password)
4848
var newSalt = Guid.NewGuid().ToString("N");
4949
password = Encrypt.Md5(password + newSalt);
5050

51-
EnsureSystemRoles();
52-
5351
var user = new User();
5452
user.Id = SystemSettings.SuperAdminId;
5553
user.Password = password;
@@ -112,6 +110,11 @@ public bool InitDefaultApp(string appName)
112110
return true;
113111
}
114112

113+
public void EnsureSystemRolePermissions()
114+
{
115+
EnsureSystemRoles();
116+
}
117+
115118
private void EnsureSystemRoles()
116119
{
117120
EnsureRole(SystemRoleConstants.SuperAdminId, "Super Administrator");

src/AgileConfig.Server.IService/ISystemInitializationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ public interface ISystemInitializationService
1414

1515
bool TryInitDefaultEnvironment();
1616

17-
Task<bool> TryInitSuperAdminRole();
17+
Task<bool> TryInitSystemRolesAndPermissions();
1818
}

0 commit comments

Comments
 (0)