├── .dockerignore ├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── arm32.yml │ ├── arm64.yml │ ├── master-ci.yml │ ├── master-pr-ci.yml │ ├── mysqlconnector.yml │ ├── publish.yml │ ├── release-xxx.yml │ └── test-cd.yml ├── .gitignore ├── .gitmodules ├── AgileConfig.sln ├── CHANGELOG.md ├── Dockerfile ├── License.txt ├── README.md ├── README_CN.md ├── README_EN.md ├── docker-compose.yml ├── dsd ├── src ├── Agile.Config.Protocol │ ├── Agile.Config.Protocol.csproj │ └── VMS.cs ├── AgileConfig.Client │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── publish2nuget.yml │ ├── .gitignore │ ├── Agile.Config.Protocol │ │ ├── AgileConfig.Protocol.csproj │ │ └── models.cs │ ├── AgileConfig.Client.sln │ ├── AgileConfig.Client │ │ ├── AgileConfig.Client.csproj │ │ ├── AgileConfigBuilderExtension.cs │ │ ├── AgileConfigProvider.cs │ │ ├── AgileConfigSource.cs │ │ ├── AssemablyUtil.cs │ │ ├── ConfigClient.cs │ │ ├── ConfigClientOptions.cs │ │ ├── Encrypt.cs │ │ ├── HttpUtil.cs │ │ ├── IConfigClient.cs │ │ ├── MessageCenter.cs │ │ ├── MessageHandlers │ │ │ ├── ConfigCenterActionMessageHandler.cs │ │ │ ├── DropMessageHandler.cs │ │ │ ├── IMessageHandler.cs │ │ │ ├── OldConfigActionMessageHandler.cs │ │ │ ├── OldConfigPingRetrunMessageHandler.cs │ │ │ └── RegisterCenterActionMessageHandler.cs │ │ ├── RandomServers.cs │ │ ├── RegisterCenter │ │ │ ├── ConfigClientExtension.cs │ │ │ ├── DiscoveryService.cs │ │ │ ├── DiscoveryServiceExtension.cs │ │ │ ├── Heartbeats │ │ │ │ ├── HeartbeatChannelPicker.cs │ │ │ │ ├── HeartbeatService.cs │ │ │ │ ├── HttpChannel.cs │ │ │ │ ├── IChannel.cs │ │ │ │ └── WebsocketChannel.cs │ │ │ ├── IDiscoveryService.cs │ │ │ ├── RegisterHostedService.cs │ │ │ ├── RegisterService.cs │ │ │ └── ServiceInfo.cs │ │ └── ServiceCollectionExtension.cs │ ├── AgileConfig.ClientTest │ │ ├── AgileConfig.ClientTest.csproj │ │ ├── Program.cs │ │ └── appsettings.json │ ├── AgileConfig.ClientTests │ │ ├── AgileConfig.UnitTests.csproj │ │ ├── ConfigClientTests.cs │ │ └── RandomServersTests.cs │ ├── AgileConfigConsoleSample │ │ ├── AgileConfigConsoleSample.csproj │ │ └── Program.cs │ ├── AgileConfigMVCSample │ │ ├── AgileConfigMVCSample.csproj │ │ ├── Controllers │ │ │ └── HomeController.cs │ │ ├── Models │ │ │ ├── ErrorViewModel.cs │ │ │ └── ServiceDownAlarmMessageVM.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Views │ │ │ ├── Home │ │ │ │ ├── Configuration.cshtml │ │ │ │ ├── Index.cshtml │ │ │ │ ├── Option.cshtml │ │ │ │ ├── Privacy.cshtml │ │ │ │ └── Services.cshtml │ │ │ ├── Shared │ │ │ │ ├── Error.cshtml │ │ │ │ ├── _Layout.cshtml │ │ │ │ └── _ValidationScriptsPartial.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ └── site.css │ │ │ ├── favicon.ico │ │ │ ├── js │ │ │ └── site.js │ │ │ └── lib │ │ │ ├── bootstrap │ │ │ ├── LICENSE │ │ │ └── dist │ │ │ │ ├── css │ │ │ │ ├── bootstrap-grid.css │ │ │ │ ├── bootstrap-grid.css.map │ │ │ │ ├── bootstrap-grid.min.css │ │ │ │ ├── bootstrap-grid.min.css.map │ │ │ │ ├── bootstrap-reboot.css │ │ │ │ ├── bootstrap-reboot.css.map │ │ │ │ ├── bootstrap-reboot.min.css │ │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ │ ├── bootstrap.css │ │ │ │ ├── bootstrap.css.map │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ │ └── js │ │ │ │ ├── bootstrap.bundle.js │ │ │ │ ├── bootstrap.bundle.js.map │ │ │ │ ├── bootstrap.bundle.min.js │ │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ │ ├── bootstrap.js │ │ │ │ ├── bootstrap.js.map │ │ │ │ ├── bootstrap.min.js │ │ │ │ └── bootstrap.min.js.map │ │ │ ├── jquery-validation-unobtrusive │ │ │ ├── LICENSE.txt │ │ │ ├── jquery.validate.unobtrusive.js │ │ │ └── jquery.validate.unobtrusive.min.js │ │ │ ├── jquery-validation │ │ │ ├── LICENSE.md │ │ │ └── dist │ │ │ │ ├── additional-methods.js │ │ │ │ ├── additional-methods.min.js │ │ │ │ ├── jquery.validate.js │ │ │ │ └── jquery.validate.min.js │ │ │ └── jquery │ │ │ ├── LICENSE.txt │ │ │ └── dist │ │ │ ├── jquery.js │ │ │ ├── jquery.min.js │ │ │ └── jquery.min.map │ ├── AgileConfigMVCSampleNET5 │ │ ├── AgileConfigMVCSampleNET5.csproj │ │ ├── Controllers │ │ │ └── WeatherForecastController.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── WeatherForecast.cs │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ ├── AgileConfigMVCSampleNET6 │ │ ├── AgileConfigMVCSampleNET6.csproj │ │ ├── Pages │ │ │ ├── Error.cshtml │ │ │ ├── Error.cshtml.cs │ │ │ ├── Index.cshtml │ │ │ ├── Index.cshtml.cs │ │ │ ├── Privacy.cshtml │ │ │ ├── Privacy.cshtml.cs │ │ │ ├── Shared │ │ │ │ ├── _Layout.cshtml │ │ │ │ └── _ValidationScriptsPartial.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ └── site.css │ │ │ ├── favicon.ico │ │ │ ├── js │ │ │ └── site.js │ │ │ └── lib │ │ │ ├── bootstrap │ │ │ ├── LICENSE │ │ │ └── dist │ │ │ │ ├── css │ │ │ │ ├── bootstrap-grid.css │ │ │ │ ├── bootstrap-grid.css.map │ │ │ │ ├── bootstrap-grid.min.css │ │ │ │ ├── bootstrap-grid.min.css.map │ │ │ │ ├── bootstrap-grid.rtl.css │ │ │ │ ├── bootstrap-grid.rtl.css.map │ │ │ │ ├── bootstrap-grid.rtl.min.css │ │ │ │ ├── bootstrap-grid.rtl.min.css.map │ │ │ │ ├── bootstrap-reboot.css │ │ │ │ ├── bootstrap-reboot.css.map │ │ │ │ ├── bootstrap-reboot.min.css │ │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ │ ├── bootstrap-reboot.rtl.css │ │ │ │ ├── bootstrap-reboot.rtl.css.map │ │ │ │ ├── bootstrap-reboot.rtl.min.css │ │ │ │ ├── bootstrap-reboot.rtl.min.css.map │ │ │ │ ├── bootstrap-utilities.css │ │ │ │ ├── bootstrap-utilities.css.map │ │ │ │ ├── bootstrap-utilities.min.css │ │ │ │ ├── bootstrap-utilities.min.css.map │ │ │ │ ├── bootstrap-utilities.rtl.css │ │ │ │ ├── bootstrap-utilities.rtl.css.map │ │ │ │ ├── bootstrap-utilities.rtl.min.css │ │ │ │ ├── bootstrap-utilities.rtl.min.css.map │ │ │ │ ├── bootstrap.css │ │ │ │ ├── bootstrap.css.map │ │ │ │ ├── bootstrap.min.css │ │ │ │ ├── bootstrap.min.css.map │ │ │ │ ├── bootstrap.rtl.css │ │ │ │ ├── bootstrap.rtl.css.map │ │ │ │ ├── bootstrap.rtl.min.css │ │ │ │ └── bootstrap.rtl.min.css.map │ │ │ │ └── js │ │ │ │ ├── bootstrap.bundle.js │ │ │ │ ├── bootstrap.bundle.js.map │ │ │ │ ├── bootstrap.bundle.min.js │ │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ │ ├── bootstrap.esm.js │ │ │ │ ├── bootstrap.esm.js.map │ │ │ │ ├── bootstrap.esm.min.js │ │ │ │ ├── bootstrap.esm.min.js.map │ │ │ │ ├── bootstrap.js │ │ │ │ ├── bootstrap.js.map │ │ │ │ ├── bootstrap.min.js │ │ │ │ └── bootstrap.min.js.map │ │ │ ├── jquery-validation-unobtrusive │ │ │ ├── LICENSE.txt │ │ │ ├── jquery.validate.unobtrusive.js │ │ │ └── jquery.validate.unobtrusive.min.js │ │ │ ├── jquery-validation │ │ │ ├── LICENSE.md │ │ │ └── dist │ │ │ │ ├── additional-methods.js │ │ │ │ ├── additional-methods.min.js │ │ │ │ ├── jquery.validate.js │ │ │ │ └── jquery.validate.min.js │ │ │ └── jquery │ │ │ ├── LICENSE.txt │ │ │ └── dist │ │ │ ├── jquery.js │ │ │ ├── jquery.min.js │ │ │ └── jquery.min.map │ ├── AgileConfigWPFSample │ │ ├── AgileConfigWPFSample.csproj │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── AssemblyInfo.cs │ │ ├── MainWindow.xaml │ │ └── MainWindow.xaml.cs │ ├── OnFrameworkTest │ │ ├── App.config │ │ ├── OnFrameworkTest.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── README.md │ └── WinServiceSample │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── WinServiceSample.csproj │ │ ├── Worker.cs │ │ ├── appsettings.Development.json │ │ └── appsettings.json ├── AgileConfig.Server.Apisite │ ├── AgileConfig - Backup.Server.Apisite.csproj │ ├── AgileConfig.Server.Apisite.csproj │ ├── AgileConfig.Server.Apisite.xml │ ├── Appsettings.cs │ ├── ConfigureJwtBearerOptions.cs │ ├── Controllers │ │ ├── AdminController.cs │ │ ├── AppController.cs │ │ ├── ConfigController.cs │ │ ├── HomeController.cs │ │ ├── RemoteOPController.cs │ │ ├── RemoteServerProxyController.cs │ │ ├── ReportController.cs │ │ ├── SSOController.cs │ │ ├── ServerNodeController.cs │ │ ├── ServiceController.cs │ │ ├── SysLogController.cs │ │ ├── UserController.cs │ │ └── api │ │ │ ├── AppController.cs │ │ │ ├── ConfigController.cs │ │ │ ├── Models │ │ │ ├── ApiAppVM.cs │ │ │ ├── ApiConfigVM.cs │ │ │ ├── ApiNodeVM.cs │ │ │ ├── ApiPublishTimelineVM.cs │ │ │ ├── ApiServiceInfoVM.cs │ │ │ ├── HeartbeatParam.cs │ │ │ ├── HeartbeatResultVM.cs │ │ │ ├── RegisterResultVM.cs │ │ │ └── RegisterServiceInfoVM.cs │ │ │ ├── NodeController.cs │ │ │ └── RegisterCenterController.cs │ ├── Filters │ │ ├── AdmBasicAuthenticationAttribute.cs │ │ ├── AppBasicAuthenticationAttribute.cs │ │ ├── ModelValidAttribute.cs │ │ ├── PermissionCheckAttribute.cs │ │ └── PermissionCheckByBasicAttribute.cs │ ├── InitService.cs │ ├── Metrics │ │ ├── IMeterService.cs │ │ └── MeterService.cs │ ├── Models │ │ ├── AppAuthVM.cs │ │ ├── AppVM.cs │ │ ├── Binders │ │ │ └── EnvQueryStringBinder.cs │ │ ├── ChangePasswordVM.cs │ │ ├── ConfigVM.cs │ │ ├── EnvString.cs │ │ ├── InitPasswordVM.cs │ │ ├── LoginVM.cs │ │ ├── Mapping │ │ │ └── ModelMappingExtension.cs │ │ ├── PublishLogVM.cs │ │ ├── SaveJsonVM.cs │ │ ├── ServerNodeVM.cs │ │ ├── ServerStatusReport.cs │ │ ├── ServiceInfoVM.cs │ │ └── UserVM.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── StartupExtension.cs │ ├── UIExtension │ │ ├── ReactUIMiddleware.cs │ │ └── UIFileBag.cs │ ├── Utilites │ │ ├── ControllerExt.cs │ │ └── IPExt.cs │ ├── Websocket │ │ ├── IWebsocketCollection.cs │ │ ├── MessageHandlers │ │ │ ├── IMessageHandler.cs │ │ │ ├── MessageHandler.cs │ │ │ ├── OldMessageHandler.cs │ │ │ └── WebsocketMessageHandlers.cs │ │ ├── WebsocketCollection.cs │ │ └── WebsocketHandlerMiddleware.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── nlog.config │ └── wwwroot │ │ └── favicon.ico ├── AgileConfig.Server.Common │ ├── AgileConfig.Server.Common.csproj │ ├── DictionaryConvertToJson.cs │ ├── EfLoggerProvider.cs │ ├── Encrypt.cs │ ├── EnumExt.cs │ ├── EnvAccessor.cs │ ├── EventBus │ │ ├── ITinyEventBus.cs │ │ ├── ServiceCollectionExt.cs │ │ └── TinyEventBus.cs │ ├── ExceptionHandlerMiddleware.cs │ ├── FunctionUtil.cs │ ├── Global.cs │ ├── HttpExt.cs │ ├── IEntity.cs │ ├── JsonConfigurationFileParser.cs │ ├── RestClient │ │ ├── DefaultRestClient.cs │ │ ├── IRestClient.cs │ │ └── ServiceCollectionEx.cs │ └── SystemSettings.cs ├── AgileConfig.Server.Data.Abstraction │ ├── AgileConfig.Server.Data.Abstraction.csproj │ ├── DbConfig │ │ ├── DbConfigInfo.cs │ │ ├── DbConfigInfoFactory.cs │ │ ├── IDbConfigInfo.cs │ │ ├── IDbConfigInfoFactory.cs │ │ └── ServiceCollectionExtension.cs │ ├── IAppInheritancedRepository.cs │ ├── IAppRepository.cs │ ├── IConfigPublishedRepository.cs │ ├── IConfigRepository.cs │ ├── IPublishDetailRepository.cs │ ├── IPublishTimelineRepository.cs │ ├── IRepository.cs │ ├── IRepositoryServiceRegister.cs │ ├── IServerNodeRepository.cs │ ├── IServiceInfoRepository.cs │ ├── ISettingRepository.cs │ ├── ISysInitRepository.cs │ ├── ISysLogRepository.cs │ ├── IUow.cs │ ├── IUserAppAuthRepository.cs │ ├── IUserRepository.cs │ └── IUserRoleRepository.cs ├── AgileConfig.Server.Data.Entity │ ├── AgileConfig.Server.Data.Entity.csproj │ ├── App.cs │ ├── AppInheritanced.cs │ ├── Config.cs │ ├── ConfigPublished.cs │ ├── PublishDetail.cs │ ├── PublishTimeline.cs │ ├── ServerNode.cs │ ├── ServiceInfo.cs │ ├── Setting.cs │ ├── SysLog.cs │ ├── User.cs │ ├── UserAppAuth.cs │ └── UserRole.cs ├── AgileConfig.Server.Data.Freesql │ ├── AgileConfig.Server.Data.Freesql.csproj │ ├── EnsureTables.cs │ ├── EnvFreeSqlFactory.cs │ ├── FluentApi.cs │ ├── FreeSqlContext.cs │ ├── FreeSqlDbContextFactory.cs │ ├── FreeSqlUow.cs │ ├── FreesqlRepository.cs │ ├── IFreeSqlFactory.cs │ ├── IMyFreeSQL.cs │ ├── MyFreeSQL.cs │ └── ServiceCollectionExt.cs ├── AgileConfig.Server.Data.Mongodb │ ├── AgileConfig.Server.Data.Mongodb.csproj │ ├── MongodbAccess.cs │ ├── MongodbRepository.cs │ └── MongodbUow.cs ├── AgileConfig.Server.Data.Repository.Freesql │ ├── AgileConfig.Server.Data.Repository.Freesql.csproj │ ├── AppInheritancedRepository.cs │ ├── AppRepository.cs │ ├── ConfigPublishedRepository.cs │ ├── ConfigRepository.cs │ ├── FreesqlRepositoryServiceRegister.cs │ ├── PublishDetailRepository.cs │ ├── PublishTimelineRepository.cs │ ├── ServerNodeRepository.cs │ ├── ServiceInfoRepository.cs │ ├── SettingRepository.cs │ ├── SysInitRepository.cs │ ├── SysLogRepository.cs │ ├── UserAppAuthRepository.cs │ ├── UserRepository.cs │ └── UserRoleRepository.cs ├── AgileConfig.Server.Data.Repository.Mongodb │ ├── AgileConfig.Server.Data.Repository.Mongodb.csproj │ ├── AppInheritancedRepository.cs │ ├── AppRepository.cs │ ├── ConfigPublishedRepository.cs │ ├── ConfigRepository.cs │ ├── MongodbRepositoryExt.cs │ ├── MongodbRepositoryServiceRegister.cs │ ├── PublishDetailRepository.cs │ ├── PublishTimelineRepository.cs │ ├── ServerNodeRepository.cs │ ├── ServiceInfoRepository.cs │ ├── SettingRepository.cs │ ├── SysInitRepository.cs │ ├── SysLogRepository.cs │ ├── UserAppAuthRepository.cs │ ├── UserRepository.cs │ ├── UserRoleRepository.cs │ └── Usings.cs ├── AgileConfig.Server.Data.Repository.Selector │ ├── AgileConfig.Server.Data.Repository.Selector.csproj │ └── RepositoryExtension.cs ├── AgileConfig.Server.Event │ ├── AgileConfig.Server.Event.csproj │ ├── ServiceInfoStatusUpdateEvents.cs │ └── SysLogEvents.cs ├── AgileConfig.Server.EventHandler │ ├── AgileConfig.Server.EventHandler.csproj │ ├── ConfigStatusUpdateEventHandlers.cs │ ├── ServiceInfoUpdateHandlers.cs │ └── SystemEventHandlers.cs ├── AgileConfig.Server.IService │ ├── AgileConfig.Server.IService.csproj │ ├── IAdmBasicAuthService.cs │ ├── IAppBasicAuthService.cs │ ├── IAppService.cs │ ├── IBasicAuthService.cs │ ├── IConfigService.cs │ ├── IEventHandlerRegister.cs │ ├── IJwtService.cs │ ├── IPermissionService.cs │ ├── IRegisterCenterService.cs │ ├── IRemoteServerNodeProxy.cs │ ├── IServerNodeService.cs │ ├── IServiceHealthCheckService.cs │ ├── IServiceInfoService.cs │ ├── ISettingService.cs │ ├── ISysLogService.cs │ ├── ISystemInitializationService.cs │ └── IUserService.cs ├── AgileConfig.Server.OIDC │ ├── AgileConfig.Server.OIDC.csproj │ ├── IOidcClient.cs │ ├── OidcClient.cs │ ├── OidcSetting.cs │ ├── ServiceCollectionExt.cs │ ├── SettingProvider │ │ ├── ConfigfileOidcSettingProvider.cs │ │ └── IOidcSettingProvider.cs │ └── TokenEndpointAuthMethods │ │ ├── BasicTokenEndpointAuthMethod.cs │ │ ├── ITokenEndpointAuthMethod.cs │ │ ├── NoneTokenEndpointAuthMethod.cs │ │ ├── PostTokenEndpointAuthMethod.cs │ │ └── TokenEndpointAuthMethodFactory.cs ├── AgileConfig.Server.Service │ ├── AdmBasicAuthService.cs │ ├── AgileConfig.Server.Service.csproj │ ├── AppBasicAuthService.cs │ ├── AppService.cs │ ├── ConfigService.cs │ ├── EventRegisterService │ │ ├── ConfigStatusUpdateEventHandlersRegister.cs │ │ ├── EventHandlerRegister.cs │ │ ├── ServiceInfoStatusUpdateEventHandlersRegister.cs │ │ └── SystemEventHandlersRegister.cs │ ├── JwtService.cs │ ├── PermissionService.cs │ ├── RegisterCenterService.cs │ ├── RemoteServerNodeProxy.cs │ ├── ServerNodeService.cs │ ├── ServiceCollectionExt.cs │ ├── ServiceHealthCheckService.cs │ ├── ServiceInfoService.cs │ ├── SettingService.cs │ ├── SysLogService.cs │ ├── SystemInitializationService.cs │ └── UserService.cs └── AgileConfig.Server.UI │ └── react-ui-antd │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierignore │ ├── .prettierrc.js │ ├── .stylelintrc.js │ ├── README.md │ ├── config │ ├── config.dev.ts │ ├── config.ts │ ├── defaultSettings.ts │ ├── proxy.ts │ └── routes.ts │ ├── jest.config.js │ ├── jsconfig.json │ ├── mock │ ├── apps.ts │ ├── clients.ts │ ├── configs.ts │ ├── listTableList.ts │ ├── logs.ts │ ├── nodes.ts │ ├── notices.ts │ ├── route.ts │ └── user.ts │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── CNAME │ ├── favicon.ico │ ├── home_bg.png │ ├── icons │ │ ├── icon-128x128.png │ │ ├── icon-192x192.png │ │ └── icon-512x512.png │ ├── monaco-editor │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── ThirdPartyNotices.txt │ │ ├── min │ │ │ └── vs │ │ │ │ ├── base │ │ │ │ ├── browser │ │ │ │ │ └── ui │ │ │ │ │ │ └── codicons │ │ │ │ │ │ └── codicon │ │ │ │ │ │ └── codicon.ttf │ │ │ │ └── worker │ │ │ │ │ └── workerMain.js │ │ │ │ ├── basic-languages │ │ │ │ ├── abap │ │ │ │ │ └── abap.js │ │ │ │ ├── apex │ │ │ │ │ └── apex.js │ │ │ │ ├── azcli │ │ │ │ │ └── azcli.js │ │ │ │ ├── bat │ │ │ │ │ └── bat.js │ │ │ │ ├── bicep │ │ │ │ │ └── bicep.js │ │ │ │ ├── cameligo │ │ │ │ │ └── cameligo.js │ │ │ │ ├── clojure │ │ │ │ │ └── clojure.js │ │ │ │ ├── coffee │ │ │ │ │ └── coffee.js │ │ │ │ ├── cpp │ │ │ │ │ └── cpp.js │ │ │ │ ├── csharp │ │ │ │ │ └── csharp.js │ │ │ │ ├── csp │ │ │ │ │ └── csp.js │ │ │ │ ├── css │ │ │ │ │ └── css.js │ │ │ │ ├── dart │ │ │ │ │ └── dart.js │ │ │ │ ├── dockerfile │ │ │ │ │ └── dockerfile.js │ │ │ │ ├── ecl │ │ │ │ │ └── ecl.js │ │ │ │ ├── elixir │ │ │ │ │ └── elixir.js │ │ │ │ ├── flow9 │ │ │ │ │ └── flow9.js │ │ │ │ ├── fsharp │ │ │ │ │ └── fsharp.js │ │ │ │ ├── go │ │ │ │ │ └── go.js │ │ │ │ ├── graphql │ │ │ │ │ └── graphql.js │ │ │ │ ├── handlebars │ │ │ │ │ └── handlebars.js │ │ │ │ ├── hcl │ │ │ │ │ └── hcl.js │ │ │ │ ├── html │ │ │ │ │ └── html.js │ │ │ │ ├── ini │ │ │ │ │ └── ini.js │ │ │ │ ├── java │ │ │ │ │ └── java.js │ │ │ │ ├── javascript │ │ │ │ │ └── javascript.js │ │ │ │ ├── julia │ │ │ │ │ └── julia.js │ │ │ │ ├── kotlin │ │ │ │ │ └── kotlin.js │ │ │ │ ├── less │ │ │ │ │ └── less.js │ │ │ │ ├── lexon │ │ │ │ │ └── lexon.js │ │ │ │ ├── liquid │ │ │ │ │ └── liquid.js │ │ │ │ ├── lua │ │ │ │ │ └── lua.js │ │ │ │ ├── m3 │ │ │ │ │ └── m3.js │ │ │ │ ├── markdown │ │ │ │ │ └── markdown.js │ │ │ │ ├── mips │ │ │ │ │ └── mips.js │ │ │ │ ├── msdax │ │ │ │ │ └── msdax.js │ │ │ │ ├── mysql │ │ │ │ │ └── mysql.js │ │ │ │ ├── objective-c │ │ │ │ │ └── objective-c.js │ │ │ │ ├── pascal │ │ │ │ │ └── pascal.js │ │ │ │ ├── pascaligo │ │ │ │ │ └── pascaligo.js │ │ │ │ ├── perl │ │ │ │ │ └── perl.js │ │ │ │ ├── pgsql │ │ │ │ │ └── pgsql.js │ │ │ │ ├── php │ │ │ │ │ └── php.js │ │ │ │ ├── pla │ │ │ │ │ └── pla.js │ │ │ │ ├── postiats │ │ │ │ │ └── postiats.js │ │ │ │ ├── powerquery │ │ │ │ │ └── powerquery.js │ │ │ │ ├── powershell │ │ │ │ │ └── powershell.js │ │ │ │ ├── protobuf │ │ │ │ │ └── protobuf.js │ │ │ │ ├── pug │ │ │ │ │ └── pug.js │ │ │ │ ├── python │ │ │ │ │ └── python.js │ │ │ │ ├── qsharp │ │ │ │ │ └── qsharp.js │ │ │ │ ├── r │ │ │ │ │ └── r.js │ │ │ │ ├── razor │ │ │ │ │ └── razor.js │ │ │ │ ├── redis │ │ │ │ │ └── redis.js │ │ │ │ ├── redshift │ │ │ │ │ └── redshift.js │ │ │ │ ├── restructuredtext │ │ │ │ │ └── restructuredtext.js │ │ │ │ ├── ruby │ │ │ │ │ └── ruby.js │ │ │ │ ├── rust │ │ │ │ │ └── rust.js │ │ │ │ ├── sb │ │ │ │ │ └── sb.js │ │ │ │ ├── scala │ │ │ │ │ └── scala.js │ │ │ │ ├── scheme │ │ │ │ │ └── scheme.js │ │ │ │ ├── scss │ │ │ │ │ └── scss.js │ │ │ │ ├── shell │ │ │ │ │ └── shell.js │ │ │ │ ├── solidity │ │ │ │ │ └── solidity.js │ │ │ │ ├── sophia │ │ │ │ │ └── sophia.js │ │ │ │ ├── sparql │ │ │ │ │ └── sparql.js │ │ │ │ ├── sql │ │ │ │ │ └── sql.js │ │ │ │ ├── st │ │ │ │ │ └── st.js │ │ │ │ ├── swift │ │ │ │ │ └── swift.js │ │ │ │ ├── systemverilog │ │ │ │ │ └── systemverilog.js │ │ │ │ ├── tcl │ │ │ │ │ └── tcl.js │ │ │ │ ├── twig │ │ │ │ │ └── twig.js │ │ │ │ ├── typescript │ │ │ │ │ └── typescript.js │ │ │ │ ├── vb │ │ │ │ │ └── vb.js │ │ │ │ ├── xml │ │ │ │ │ └── xml.js │ │ │ │ └── yaml │ │ │ │ │ └── yaml.js │ │ │ │ ├── editor │ │ │ │ ├── editor.main.css │ │ │ │ ├── editor.main.js │ │ │ │ ├── editor.main.nls.de.js │ │ │ │ ├── editor.main.nls.es.js │ │ │ │ ├── editor.main.nls.fr.js │ │ │ │ ├── editor.main.nls.it.js │ │ │ │ ├── editor.main.nls.ja.js │ │ │ │ ├── editor.main.nls.js │ │ │ │ ├── editor.main.nls.ko.js │ │ │ │ ├── editor.main.nls.ru.js │ │ │ │ ├── editor.main.nls.zh-cn.js │ │ │ │ └── editor.main.nls.zh-tw.js │ │ │ │ ├── language │ │ │ │ ├── css │ │ │ │ │ ├── cssMode.js │ │ │ │ │ └── cssWorker.js │ │ │ │ ├── html │ │ │ │ │ ├── htmlMode.js │ │ │ │ │ └── htmlWorker.js │ │ │ │ ├── json │ │ │ │ │ ├── jsonMode.js │ │ │ │ │ └── jsonWorker.js │ │ │ │ └── typescript │ │ │ │ │ ├── tsMode.js │ │ │ │ │ └── tsWorker.js │ │ │ │ └── loader.js │ │ ├── monaco.d.ts │ │ └── package.json │ └── pro_icon.svg │ ├── src │ ├── assets │ │ ├── avatar.png │ │ ├── logo.png │ │ └── logo.svg │ ├── components │ │ ├── Authorized │ │ │ ├── Authorized.tsx │ │ │ ├── AuthorizedElement.tsx │ │ │ ├── AuthorizedRoute.tsx │ │ │ ├── CheckPermissions.tsx │ │ │ ├── PromiseRender.tsx │ │ │ ├── Secured.tsx │ │ │ ├── index.tsx │ │ │ └── renderAuthorize.ts │ │ ├── ChangePassword │ │ │ └── changePassword.tsx │ │ ├── GlobalHeader │ │ │ ├── AvatarDropdown.tsx │ │ │ ├── NoticeIconView.tsx │ │ │ ├── RightContent.tsx │ │ │ └── index.less │ │ ├── HeaderDropdown │ │ │ ├── index.less │ │ │ └── index.tsx │ │ ├── HeaderSearch │ │ │ ├── index.less │ │ │ └── index.tsx │ │ ├── NoticeIcon │ │ │ ├── NoticeList.less │ │ │ ├── NoticeList.tsx │ │ │ ├── index.less │ │ │ └── index.tsx │ │ └── PageLoading │ │ │ └── index.tsx │ ├── e2e │ │ ├── __mocks__ │ │ │ └── antd-pro-merge-less.js │ │ └── baseLayout.e2e.js │ ├── global.less │ ├── global.tsx │ ├── layouts │ │ ├── BasicLayout.tsx │ │ ├── BlankLayout.tsx │ │ ├── SecurityLayout.tsx │ │ ├── UserLayout.less │ │ ├── UserLayout.tsx │ │ └── compos │ │ │ └── LayoutFooter.tsx │ ├── locales │ │ ├── en-US.ts │ │ ├── en-US │ │ │ ├── component.ts │ │ │ ├── err_code.ts │ │ │ ├── globalHeader.ts │ │ │ ├── menu.ts │ │ │ ├── pages.ts │ │ │ ├── pwa.ts │ │ │ ├── settingDrawer.ts │ │ │ └── settings.ts │ │ ├── zh-CN.ts │ │ └── zh-CN │ │ │ ├── component.ts │ │ │ ├── err_code.ts │ │ │ ├── globalHeader.ts │ │ │ ├── menu.ts │ │ │ ├── pages.ts │ │ │ ├── pwa.ts │ │ │ ├── settingDrawer.ts │ │ │ └── settings.ts │ ├── manifest.json │ ├── models │ │ ├── connect.d.ts │ │ ├── functionKeys.ts │ │ ├── global.ts │ │ ├── login.ts │ │ ├── setting.ts │ │ └── user.ts │ ├── pages │ │ ├── 404.tsx │ │ ├── Admin.tsx │ │ ├── Apps │ │ │ ├── comps │ │ │ │ ├── updateForm.tsx │ │ │ │ └── userAuth.tsx │ │ │ ├── data.d.ts │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── Clients │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── Configs │ │ │ ├── comps │ │ │ │ ├── EnvSync.tsx │ │ │ │ ├── JsonEditor.tsx │ │ │ │ ├── JsonImport.tsx │ │ │ │ ├── TextEditor.tsx │ │ │ │ ├── jsonImport.less │ │ │ │ ├── updateForm.tsx │ │ │ │ ├── versionHistory.less │ │ │ │ └── versionHistory.tsx │ │ │ ├── data.d.ts │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── Home │ │ │ ├── comps │ │ │ │ ├── itemInfo.tsx │ │ │ │ ├── latestVisitApps.tsx │ │ │ │ ├── nodeClientStatiCharts.tsx │ │ │ │ └── summary.tsx │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── Logs │ │ │ ├── data.d.ts │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── Nodes │ │ │ ├── data.d.ts │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── OIDC │ │ │ ├── data.d.ts │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── Services │ │ │ ├── data.d.ts │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── service.ts │ │ ├── User │ │ │ ├── comps │ │ │ │ └── updateUser.tsx │ │ │ ├── data.d.ts │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ ├── initPassword │ │ │ │ ├── data.d.ts │ │ │ │ ├── index.less │ │ │ │ ├── index.tsx │ │ │ │ └── service.ts │ │ │ ├── login │ │ │ │ ├── index.less │ │ │ │ ├── index.tsx │ │ │ │ └── service.ts │ │ │ └── service.ts │ │ ├── Welcome.less │ │ ├── Welcome.tsx │ │ └── document.ejs │ ├── service-worker.js │ ├── services │ │ ├── login.ts │ │ ├── system.ts │ │ └── user.ts │ ├── typings.d.ts │ └── utils │ │ ├── Authorized.ts │ │ ├── authority.ts │ │ ├── latestVisitApps.ts │ │ ├── request.ts │ │ ├── system.ts │ │ ├── utils.less │ │ ├── utils.test.ts │ │ └── utils.ts │ ├── tests │ ├── PuppeteerEnvironment.js │ ├── beforeTest.js │ ├── getBrowser.js │ └── run-tests.js │ └── tsconfig.json └── test ├── AgileConfig.Server.CommonTests ├── AgileConfig.Server.CommonTests.csproj ├── DictionaryConvertToJsonTests.cs └── EncryptTests.cs ├── AgileConfig.Server.Data.AbstractionTests ├── AgileConfig.Server.Data.AbstractionTests.csproj └── DbConfig │ └── DbConfigInfoFactoryTests.cs ├── AgileConfig.Server.Data.FreesqlTests ├── AgileConfig.Server.Data.FreesqlTests.csproj ├── FreeSQLTests.cs └── FreeSqlUowTests.cs ├── AgileConfig.Server.ServiceTests ├── AgileConfig.Server.ServiceTests.csproj ├── EnsureTablesTests.cs ├── ISettingServiceTests.cs ├── PostgreSQL │ ├── AppServiceTests.cs │ ├── ConfigServiceTests.cs │ ├── ServerNodeServiceTests.cs │ ├── SettingServiceTests.cs │ └── SysLogServiceTests.cs ├── mongodb │ ├── AppServiceTests.cs │ ├── Basic.cs │ ├── ConfigServiceTests.cs │ ├── ServerNodeServiceTests.cs │ ├── SettingServiceTests.cs │ └── SysLogServiceTests.cs ├── mysql │ ├── AppServiceTests.cs │ ├── ConfigServiceTests.cs │ ├── ServerNodeServiceTests.cs │ ├── SettingServiceTests.cs │ └── SysLogServiceTests.cs ├── oracle │ ├── AppServiceTests.cs │ ├── ConfigServiceTests.cs │ ├── ServerNodeServiceTests.cs │ ├── SettingServiceTests.cs │ └── SysLogServiceTests.cs ├── sqlite │ ├── AppServiceTests.cs │ ├── BasicTestService.cs │ ├── ConfigServiceTests.cs │ ├── ServerNodeServiceTests.cs │ ├── SettingServiceTests.cs │ └── SysLogServiceTests.cs └── sqlserver │ ├── AppServiceTests.cs │ ├── ConfigServiceTests.cs │ ├── ServerNodeServiceTests.cs │ ├── SettingServiceTests.cs │ └── SysLogServiceTests.cs └── ApiSiteTests ├── ApiSiteTests.csproj ├── Filters └── BasicAuthenticationAttributeTests.cs ├── TestApiConfigController.cs ├── TestAppController.cs └── Websocket └── WebsocketCollectionTests.cs /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | open_collective: AgileConfig 2 | -------------------------------------------------------------------------------- /.github/workflows/master-pr-ci.yml: -------------------------------------------------------------------------------- 1 | name: master pr ci workflow 2 | 3 | on: 4 | pull_request: 5 | branches: [ master ] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build-reactapp: 10 | runs-on: ubuntu-latest 11 | defaults: 12 | run: 13 | working-directory: src/AgileConfig.Server.UI/react-ui-antd 14 | strategy: 15 | matrix: 16 | node-version: [16.x] 17 | 18 | steps: 19 | - uses: actions/checkout@v2 20 | - name: Use Node.js ${{ matrix.node-version }} 21 | uses: actions/setup-node@v1 22 | with: 23 | node-version: ${{ matrix.node-version }} 24 | 25 | - run: npm install 26 | - run: npm run build 27 | build-dotnet: 28 | runs-on: ubuntu-latest 29 | 30 | steps: 31 | - uses: actions/checkout@v3 32 | - name: Setup .NET 33 | uses: actions/setup-dotnet@v3 34 | with: 35 | dotnet-version: 8.0.x 36 | - name: Restore dependencies 37 | run: dotnet restore 38 | - name: Build 39 | run: dotnet build --no-restore 40 | - name: Test 41 | run: dotnet test --no-build --verbosity normal 42 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "AgileConfig.Client"] 2 | path = AgileConfig.Client 3 | url = https://github.com/kklldog/AgileConfig_Client.git 4 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 minjie-zhou 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /dsd: -------------------------------------------------------------------------------- 1 | 0.0.1 2 | 1.0.0 3 | 1.0.1 4 | 1.0.2 5 | 1.0.3 6 | 1.0.4 7 | 1.0.5 8 | 1.0.6 9 | 1.0.7 10 | 1.0.8 11 | 1.1.0 12 | 1.1.1 13 | 1.1.2 14 | 1.1.3 15 | 1.1.4 16 | 1.1.5 17 | 1.1.6 18 | 1.1.7 19 | 1.1.7.1 20 | 1.1.7.2 21 | p1.2.0 22 | preview-1.2.0 23 | preview-1.2.0.1 24 | preview-1.2.0.2 25 | preview-1.2.0.3 26 | preview-1.3.0 27 | preview-1.3.1 28 | realease-1.3.8.1 29 | release-1.1.9 30 | release-1.2.0.3 31 | release-1.2.0.4 32 | release-1.2.1 33 | release-1.2.1.1 34 | release-1.2.1.2 35 | release-1.2.3 36 | release-1.2.3.1 37 | release-1.2.3.2 38 | release-1.2.3.3 39 | release-1.2.4 40 | release-1.3.1 41 | release-1.3.2 42 | release-1.3.3 43 | release-1.3.4 44 | release-1.3.5 45 | release-1.3.6 46 | release-1.3.7 47 | release-1.3.8 48 | release-1.3.8.2 49 | release-1.3.8.3 50 | release-1.3.8.4 51 | release-1.4.0 52 | release-1.4.1 53 | release-1.4.2 54 | release-1.4.3 55 | release-1.5.0 56 | release-1.5.1 57 | release-1.5.1.1 58 | release-1.5.1.2 59 | release-1.5.1.3 60 | release-1.5.1.4 61 | release-1.5.1.5 62 | release-1.5.2 63 | release-1.8.3.4 64 | v-1.5.2 65 | v1.5.2 66 | v1.5.3 67 | -------------------------------------------------------------------------------- /src/Agile.Config.Protocol/Agile.Config.Protocol.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Agile.Config.Protocol/VMS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Agile.Config.Protocol 4 | { 5 | public class ActionConst 6 | { 7 | public const string Offline = "offline"; 8 | public const string Reload = "reload"; 9 | public const string Ping = "ping"; 10 | } 11 | 12 | public class ActionModule 13 | { 14 | public const string RegisterCenter = "r"; 15 | public const string ConfigCenter = "c"; 16 | } 17 | 18 | public class WebsocketAction 19 | { 20 | public WebsocketAction() 21 | { 22 | } 23 | public string Module { get; set; } 24 | public string Action { get; set; } 25 | 26 | public string Data { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/Agile.Config.Protocol/AgileConfig.Protocol.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/Agile.Config.Protocol/models.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AgileConfig.Protocol 4 | { 5 | public class ConfigItem 6 | { 7 | public string key { get; set; } 8 | 9 | public string value { get; set; } 10 | 11 | public string group { get; set; } 12 | } 13 | 14 | public class ActionConst 15 | { 16 | public const string Add = "add"; 17 | public const string Update = "update"; 18 | public const string Remove = "remove"; 19 | public const string Offline = "offline"; 20 | public const string Reload = "reload"; 21 | 22 | public const string Ping = "ping"; 23 | 24 | } 25 | 26 | public class ActionMessage 27 | { 28 | public string Module { get; set; } 29 | public string Action { get; set; } 30 | 31 | public string Data { get; set; } 32 | } 33 | 34 | public class ActionModule 35 | { 36 | public const string RegisterCenter = "r"; 37 | public const string ConfigCenter = "c"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/AgileConfigProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.Logging; 3 | using System; 4 | 5 | namespace AgileConfig.Client 6 | { 7 | public class AgileConfigProvider : ConfigurationProvider 8 | { 9 | private ConfigClient Client { get; } 10 | 11 | public AgileConfigProvider(IConfigClient client) 12 | { 13 | Client = client as ConfigClient; 14 | Client.ConfigChanged += (arg) => 15 | { 16 | this.OnReload(); 17 | }; 18 | } 19 | 20 | /// 21 | /// load方法调用ConfigClient的Connect方法,Connect方法会在连接成功后拉取所有的配置。 22 | /// 23 | public override void Load() 24 | { 25 | Client.ConnectAsync().GetAwaiter().GetResult() ; 26 | Data = Client.Data; 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/AgileConfigSource.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Client; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.Hosting 7 | { 8 | public class AgileConfigSource : IConfigurationSource 9 | { 10 | protected IConfigClient ConfigClient { get; } 11 | 12 | public AgileConfigSource(IConfigClient client) 13 | { 14 | ConfigClient = client; 15 | } 16 | public IConfigurationProvider Build(IConfigurationBuilder builder) 17 | { 18 | return new AgileConfigProvider(ConfigClient); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/AssemablyUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AgileConfig.Client 6 | { 7 | internal class AssemablyUtil 8 | { 9 | public static string GetVer() 10 | { 11 | var type = typeof(AssemablyUtil); 12 | var ver = type.Assembly.GetName().Version; 13 | 14 | return $"{ver.Major}.{ver.Minor}.{ver.Build}"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/Encrypt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Security.Cryptography; 4 | using System.Text; 5 | 6 | namespace AgileConfig.Client 7 | { 8 | internal class Encrypt 9 | { 10 | public static string Md5(string txt) 11 | { 12 | using (var md5 = MD5.Create()) 13 | { 14 | var inputBytes = Encoding.ASCII.GetBytes(txt); 15 | var hashBytes = md5.ComputeHash(inputBytes); 16 | 17 | // Convert the byte array to hexadecimal string 18 | var sb = new StringBuilder(); 19 | for (var i = 0; i < hashBytes.Length; i++) 20 | { 21 | sb.Append(hashBytes[i].ToString("X2")); 22 | } 23 | return sb.ToString(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/MessageCenter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Client 7 | { 8 | class MessageCenter 9 | { 10 | public static event Action Subscribe; 11 | public static void Receive(string message) 12 | { 13 | Subscribe?.Invoke(message); 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/MessageHandlers/DropMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Client.MessageHandlers 7 | { 8 | /// 9 | /// 老版本的服务端回复配置client的心跳消息的处理类 10 | /// 11 | class DropMessageHandler 12 | { 13 | public static bool Hit(string message) 14 | { 15 | return string.IsNullOrEmpty(message) || message == "0"; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/MessageHandlers/IMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AgileConfig.Client.MessageHandlers 6 | { 7 | interface IMessageHandler 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/MessageHandlers/OldConfigPingRetrunMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Client.MessageHandlers 7 | { 8 | /// 9 | /// 老版本的服务端回复配置client的心跳消息的处理类 10 | /// 11 | class OldConfigPingRetrunMessageHandler 12 | { 13 | public static bool Hit(string message) 14 | { 15 | if (string.IsNullOrEmpty(message)) 16 | { 17 | return false; 18 | } 19 | 20 | return message.StartsWith("V:"); 21 | } 22 | 23 | public static async Task Handle(string message, ConfigClient client) 24 | { 25 | var version = message.Substring(2, message.Length - 2); 26 | var localVersion = client.DataMd5Version(); 27 | if (version != localVersion) 28 | { 29 | //如果数据库版本跟本地版本不一致则直接全部更新 30 | await client.Load(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/MessageHandlers/RegisterCenterActionMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Protocol; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace AgileConfig.Client.MessageHandlers 8 | { 9 | class RegisterCenterActionMessageHandler 10 | { 11 | public static bool Hit(string message) 12 | { 13 | if (string.IsNullOrEmpty(message)) 14 | { 15 | return false; 16 | } 17 | 18 | var action = JsonConvert.DeserializeObject(message); 19 | if (action == null) 20 | { 21 | return false; 22 | } 23 | 24 | return action.Module == ActionModule.RegisterCenter; 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/RegisterCenter/ConfigClientExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Linq; 5 | 6 | namespace AgileConfig.Client.RegisterCenter 7 | { 8 | public static class ConfigClientExtension 9 | { 10 | public static IDiscoveryService DiscoveryService(this IConfigClient client) 11 | { 12 | return RegisterCenter.DiscoveryService.Instance; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/RegisterCenter/Heartbeats/HeartbeatChannelPicker.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AgileConfig.Client.RegisterCenter.Heartbeats 7 | { 8 | public class HeartbeatChannelPicker 9 | { 10 | private ILoggerFactory _loggerFactory; 11 | private IConfigClient _client; 12 | 13 | private IChannel _wsChan; 14 | private IChannel _httpChan; 15 | 16 | public HeartbeatChannelPicker(IConfigClient client, ILoggerFactory loggerFactory) 17 | { 18 | _client = client; 19 | _loggerFactory = loggerFactory; 20 | _wsChan = new WebsocketChannel(_client, _loggerFactory.CreateLogger()); 21 | _httpChan = new HttpChannel(_client.Options, _loggerFactory.CreateLogger()); 22 | } 23 | 24 | public IChannel Pick() 25 | { 26 | if (_client != null && _client.WebSocket.State == System.Net.WebSockets.WebSocketState.Open) 27 | { 28 | return _wsChan; 29 | } 30 | 31 | return _httpChan; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/RegisterCenter/Heartbeats/IChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Client.RegisterCenter.Heartbeats 7 | { 8 | public interface IChannel 9 | { 10 | Task SendAsync(string serviceUniqueId); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/RegisterCenter/IDiscoveryService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Client.RegisterCenter 7 | { 8 | public interface IDiscoveryService 9 | { 10 | string DataVersion { get; } 11 | List UnHealthyServices { get; } 12 | List HealthyServices { get; } 13 | List Services { get; } 14 | Task RefreshAsync(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.Client/RegisterCenter/ServiceInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AgileConfig.Client.RegisterCenter 4 | { 5 | public enum ServiceStatus 6 | { 7 | Unhealthy = 0, 8 | Healthy = 1 9 | } 10 | 11 | public class ServiceInfo 12 | { 13 | public string ServiceId { get; set; } = ""; 14 | 15 | public string ServiceName { get; set; } = ""; 16 | 17 | public string Ip { get; set; } = ""; 18 | 19 | public int? Port { get; set; } 20 | 21 | public List MetaData { get; set; } = new List(); 22 | 23 | public ServiceStatus Status { get; set; } 24 | } 25 | 26 | public class ServiceRegisterInfo: ServiceInfo 27 | { 28 | /// 29 | /// 健康检测地址 30 | /// 31 | public string CheckUrl { get; set; } = ""; 32 | 33 | /// 34 | /// 服务不健康的时候通知地址 35 | /// 36 | public string AlarmUrl { get; set; } = ""; 37 | 38 | public string HeartBeatMode { get; set; } = "client"; 39 | 40 | public int Interval { get; set; } = 30; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.ClientTest/AgileConfig.ClientTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Always 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.ClientTest/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "AgileConfig": { 3 | "appId": "test_app", 4 | "secret": "test_app", 5 | //"nodes": "http://agileconfig_server.xbaby.xyz/", 6 | "nodes": "http://localhost:5000", 7 | "name": "哈哈", 8 | "tag": "tag1", 9 | "env": "DEV", 10 | "httpTimeout": "10", //s 11 | "cache": { // 指定缓存文件的目录 12 | "directory": "c:/data" 13 | }, 14 | "serviceRegister": { //服务注册信息 15 | "serviceId": "test_app_service_02", //服务id,全局唯一,用来唯一标示某个服务 16 | "serviceName": "test_client", //服务名,可以重复,某个服务多实例部署的时候这个serviceName就可以重复 17 | "ip": "127.0.0.1", //服务的ip 18 | "port": 5002, //服务的端口 19 | "alarmUrl": "http://127.0.0.1:5100/home/servicedown", //告警地址,当服务不健康或者被移除的时候会往这个url post 数据,以便提醒 20 | "metaData": [ 21 | "this is a test client" 22 | ], 23 | "heartbeat": { 24 | "interval": 5 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfig.ClientTests/AgileConfig.UnitTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigConsoleSample/AgileConfigConsoleSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/AgileConfigMVCSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AgileConfigMVCSample.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Models/ServiceDownAlarmMessageVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfigMVCSample.Models 7 | { 8 | public class ServiceDownAlarmMessageVM 9 | { 10 | public string UniqueId { get; set; } 11 | 12 | public string ServiceId { get; set; } 13 | 14 | public string ServiceName { get; set; } 15 | 16 | public DateTime Time { get; set; } 17 | 18 | public string Status { get; set; } 19 | 20 | public string Message { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:50870", 7 | "sslPort": 44302 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "AgileConfigMVCSample": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5100", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/Home/Configuration.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Configuration"; 3 | } 4 | 5 |
6 |

7 |

8 | userId: @ViewBag.userId 9 |

10 |

11 |

12 |

13 | db connection: @ViewBag.dbConn 14 |

15 |

16 |
17 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 |
6 |

7 |

8 | 9 | ByIConfiguration 10 | 11 |

12 |

13 |

14 |

15 | 16 | ByInstance 17 | 18 |

19 |

20 |

21 |

22 | 23 | ByOptions 24 | 25 |

26 |

27 |

28 |

29 | 30 | ByOptionsSnapshot 31 | 32 |

33 |

34 |

35 |

36 | 37 | ByOptionsMonitor 38 | 39 |

40 |

41 |

42 |

43 | 44 | Services 45 | 46 |

47 |

48 |
49 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/Home/Option.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Option"; 3 | } 4 | 5 |
6 |

7 |

8 | db connection: @ViewBag.dbConn 9 |

10 |

11 |
12 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Use this page to detail your site's privacy policy.

7 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/Home/Services.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Services"; 3 | } 4 | 5 |
6 |

7 | @ViewBag.services 8 |

9 |
10 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |

26 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using AgileConfigMVCSample 2 | @using AgileConfigMVCSample.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Trace", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/appsettings.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Client/AgileConfigMVCSample/appsettings.json -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Client/AgileConfigMVCSample/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSample/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET5/AgileConfigMVCSampleNET5.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET5/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using AgileConfig.Client; 8 | 9 | namespace AgileConfigMVCSampleNET5 10 | { 11 | public class Program 12 | { 13 | public static void Main(string[] args) 14 | { 15 | CreateHostBuilder(args).Build().Run(); 16 | } 17 | 18 | public static IHostBuilder CreateHostBuilder(string[] args) => 19 | Host.CreateDefaultBuilder(args) 20 | .UseAgileConfig((ConfigClientOptions op) => 21 | { 22 | op.Name = "xxx"; 23 | op.Tag = "NET5"; 24 | }) 25 | .ConfigureWebHostDefaults(webBuilder => 26 | { 27 | webBuilder.UseStartup(); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET5/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:57869", 8 | "sslPort": 0 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "swagger", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "AgileConfigMVCSampleNET5": { 21 | "commandName": "Project", 22 | "dotnetRunMessages": "true", 23 | "launchBrowser": true, 24 | "launchUrl": "swagger", 25 | "applicationUrl": "http://localhost:5002", 26 | "environmentVariables": { 27 | "ASPNETCORE_ENVIRONMENT": "Development" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET5/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AgileConfigMVCSampleNET5 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET5/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Trace", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET5/appsettings.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Client/AgileConfigMVCSampleNET5/appsettings.json -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/AgileConfigMVCSampleNET6.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ErrorModel 3 | @{ 4 | ViewData["Title"] = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | @if (Model.ShowRequestId) 11 | { 12 |

13 | Request ID: @Model.RequestId 14 |

15 | } 16 | 17 |

Development Mode

18 |

19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |

21 |

22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |

27 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | using System.Diagnostics; 4 | 5 | namespace AgileConfigMVCSampleNET6.Pages 6 | { 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model IndexModel 3 | @{ 4 | ViewData["Title"] = "Home page"; 5 | } 6 | 7 |
8 |

Welcome

9 |

Learn about building Web apps with ASP.NET Core.

10 |
11 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace AgileConfigMVCSampleNET6.Pages 5 | { 6 | public class IndexModel : PageModel 7 | { 8 | private readonly ILogger _logger; 9 | private readonly IConfiguration _configuration; 10 | 11 | public IndexModel(ILogger logger, IConfiguration configuration) 12 | { 13 | _logger = logger; 14 | _configuration = configuration; 15 | } 16 | 17 | public void OnGet() 18 | { 19 | 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model PrivacyModel 3 | @{ 4 | ViewData["Title"] = "Privacy Policy"; 5 | } 6 |

@ViewData["Title"]

7 | 8 |

Use this page to detail your site's privacy policy.

9 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/Privacy.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace AgileConfigMVCSampleNET6.Pages 5 | { 6 | public class PrivacyModel : PageModel 7 | { 8 | private readonly ILogger _logger; 9 | 10 | public PrivacyModel(ILogger logger) 11 | { 12 | _logger = logger; 13 | } 14 | 15 | public void OnGet() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using AgileConfigMVCSampleNET6 2 | @namespace AgileConfigMVCSampleNET6.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Program.cs: -------------------------------------------------------------------------------- 1 | using Serilog; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | builder.Host.UseSerilog((ctx, lc) => lc 5 | .WriteTo.Console() 6 | ); 7 | //use agileconfig client 8 | builder.Host.UseAgileConfig(); 9 | 10 | // Add services to the container. 11 | builder.Services.AddRazorPages(); 12 | 13 | var app = builder.Build(); 14 | // Configure the HTTP request pipeline. 15 | if (!app.Environment.IsDevelopment()) 16 | { 17 | app.UseExceptionHandler("/Error"); 18 | } 19 | app.UseStaticFiles(); 20 | 21 | app.UseRouting(); 22 | 23 | app.UseAuthorization(); 24 | 25 | app.MapRazorPages(); 26 | 27 | app.Run(); 28 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:51379", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "AgileConfigMVCSampleNET6": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "http://localhost:5234", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Trace", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | //agile_config 10 | "AgileConfig": { 11 | "appId": "test_app", 12 | "secret": "test_app", 13 | "nodes": "http://agileconfig_server.xbaby.xyz/", 14 | "name": "client123", 15 | "tag": "tag123", 16 | "serviceRegister": { //服务注册信息,如果不配置该节点,则不会启动任何跟服务注册相关的服务 可选 17 | "serviceId": "net6", //服务id,全局唯一,用来唯一标示某个服务 18 | "serviceName": "net6MVC服务测试", //服务名,可以重复,某个服务多实例部署的时候这个serviceName就可以重复 19 | "ip": "127.0.0.1", //服务的ip 可选 20 | "port": 5005, //服务的端口 可选 21 | "metaData": [ //携带服务的其他元数据 可选 22 | "v1" 23 | ] 24 | //"alarmUrl": "http://127.0.0.1:5100/servicedown", //告警地址,当服务不健康或者被移除的时候会往这个url post 数据,以便提醒 可选 25 | //"heartbeat": { 26 | // "mode": "server", //指定心跳的模式,server/client 。server代表服务端主动检测,client代表客户端主动上报。不填默认client模式 可选 27 | // "url": "http://127.0.0.1:5002/WeatherForecast", //心跳模式为 server 的时候需要填写健康检测地址,如果是httpstatus=200则判定存活,其它都视为失败 可选 28 | // "interval": 30 可选 29 | //} 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Client/AgileConfigMVCSampleNET6/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigMVCSampleNET6/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigWPFSample/AgileConfigWPFSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigWPFSample/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigWPFSample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using AgileConfig.Client; 9 | 10 | namespace AgileConfigWPFSample 11 | { 12 | /// 13 | /// Interaction logic for App.xaml 14 | /// 15 | public partial class App : Application 16 | { 17 | public static ConfigClient ConfigClient { get; private set; } 18 | private void Application_Startup(object sender, StartupEventArgs e) 19 | { 20 | //跟控制台项目一样,appid等信息取决于你如何获取。你可以写死,可以从配置文件读取,可以从别的web service读取。 21 | var appId = "test_app"; 22 | var secret = "test_app"; 23 | var nodes = "http://agileconfig_server.xbaby.xyz/"; 24 | ConfigClient = new ConfigClient(appId, secret, nodes, "DEV"); 25 | ConfigClient.Name = "wpfconfigclient"; 26 | ConfigClient.Tag = "t1"; 27 | ConfigClient.ConnectAsync().GetAwaiter(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigWPFSample/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigWPFSample/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/AgileConfigWPFSample/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AgileConfigWPFSample 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void Window_Loaded(object sender, RoutedEventArgs e) 29 | { 30 | this.tbx1.Text = App.ConfigClient["userId"]; 31 | this.tbx2.Text = App.ConfigClient["connection"]; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/OnFrameworkTest/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/OnFrameworkTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("OnFrameworkTest")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OnFrameworkTest")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("278206be-f59f-4d3f-a5c5-6a11b52e3a3b")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/WinServiceSample/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Microsoft.Extensions.Hosting; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using Microsoft.AspNetCore.Hosting; 8 | 9 | namespace WinServiceSample 10 | { 11 | public class Program 12 | { 13 | public static void Main(string[] args) 14 | { 15 | CreateHostBuilder(args).Build().Run(); 16 | } 17 | 18 | public static IHostBuilder CreateHostBuilder(string[] args) => 19 | Host.CreateDefaultBuilder(args) 20 | .UseAgileConfig() 21 | .UseWindowsService(options => 22 | { 23 | options.ServiceName = "AglieConfigClientService"; 24 | }) 25 | .ConfigureServices((hostContext, services) => 26 | { 27 | services.AddHostedService(); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/WinServiceSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "WinServiceSample": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": "true", 6 | "environmentVariables": { 7 | "DOTNET_ENVIRONMENT": "Development" 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/WinServiceSample/WinServiceSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | dotnet-WinServiceSample-609BBACF-4A2A-4320-862A-66224ACC1C4C 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/WinServiceSample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Client/WinServiceSample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AgileConfig": { 10 | "appId": "test_app", 11 | "secret": "test_app", 12 | "nodes": "http://agileconfig_server.xbaby.xyz/", 13 | //"nodes": "http://localhost:5000", 14 | "name": "x", 15 | "tag": "tag1", 16 | "env": "DEV", 17 | "httpTimeout": "10" //s 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/ConfigureJwtBearerOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using AgileConfig.Server.IService; 3 | using Microsoft.AspNetCore.Authentication.JwtBearer; 4 | using Microsoft.Extensions.Options; 5 | using Microsoft.IdentityModel.Tokens; 6 | 7 | namespace AgileConfig.Server.Apisite; 8 | 9 | public class ConfigureJwtBearerOptions( 10 | IJwtService jwtService) : IConfigureNamedOptions 11 | { 12 | public void Configure(JwtBearerOptions options) 13 | { 14 | options.TokenValidationParameters = new TokenValidationParameters 15 | { 16 | ValidIssuer = jwtService.Issuer, 17 | ValidAudience = jwtService.Audience, 18 | IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtService.GetSecurityKey())), 19 | }; 20 | } 21 | 22 | public void Configure(string name, JwtBearerOptions options) 23 | { 24 | Configure(options); 25 | } 26 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Controllers/api/Models/ApiPublishTimelineVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.Apisite.Controllers.api.Models 7 | { 8 | public class ApiPublishTimelineVM 9 | { 10 | /// 11 | /// 编号 12 | /// 13 | public string Id { get; set; } 14 | /// 15 | /// 应用id 16 | /// 17 | public string AppId { get; set; } 18 | 19 | /// 20 | /// 发布时间 21 | /// 22 | public DateTime? PublishTime { get; set; } 23 | 24 | /// 25 | /// 发布者 26 | /// 27 | public string PublishUserId { get; set; } 28 | 29 | /// 30 | /// 发布版本序号 31 | /// 32 | public int Version { get; set; } 33 | 34 | /// 35 | /// 发布日志 36 | /// 37 | public string Log { get; set; } 38 | 39 | /// 40 | /// 环境 41 | /// 42 | public string Env { get; set; } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Controllers/api/Models/ApiServiceInfoVM.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using AgileConfig.Server.Data.Entity; 3 | 4 | namespace AgileConfig.Server.Apisite.Controllers.api.Models 5 | { 6 | public class ApiServiceInfoVM 7 | { 8 | public string ServiceId { get; set; } = ""; 9 | 10 | public string ServiceName { get; set; } = ""; 11 | 12 | public string Ip { get; set; } = ""; 13 | 14 | public int? Port { get; set; } 15 | 16 | public List MetaData { get; set; } = new List(); 17 | 18 | public ServiceStatus Status { get; set; } 19 | } 20 | 21 | public class QueryServiceInfoResultVM 22 | { 23 | public List Data { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Controllers/api/Models/HeartbeatParam.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Apisite.Controllers.api.Models 2 | { 3 | public class HeartbeatParam 4 | { 5 | public string UniqueId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Controllers/api/Models/HeartbeatResultVM.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Agile.Config.Protocol; 3 | 4 | namespace AgileConfig.Server.Apisite.Controllers.api.Models 5 | { 6 | public class HeartbeatResultVM: WebsocketAction 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Controllers/api/Models/RegisterResultVM.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Apisite.Controllers.api.Models 2 | { 3 | public class RegisterResultVM 4 | { 5 | public string UniqueId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Filters/ModelValidAttribute.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.Filters; 4 | 5 | namespace AgileConfig.Server.Apisite.Filters 6 | { 7 | public class ModelVaildateAttribute : ActionFilterAttribute 8 | { 9 | public override void OnActionExecuting(ActionExecutingContext context) 10 | { 11 | if (!context.ModelState.IsValid) 12 | { 13 | var errMsg = new StringBuilder(); 14 | foreach (var item in context.ModelState.Values) 15 | { 16 | foreach (var error in item.Errors) 17 | { 18 | errMsg.Append(error.ErrorMessage + ";"); 19 | } 20 | } 21 | 22 | context.Result = new JsonResult(new { 23 | success = false, 24 | message = errMsg.ToString() 25 | }); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Metrics/IMeterService.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.Metrics; 2 | 3 | namespace AgileConfig.Server.Apisite.Metrics 4 | { 5 | public interface IMeterService 6 | { 7 | ObservableGauge AppGauge { get; } 8 | ObservableGauge ClientGauge { get; } 9 | ObservableGauge ConfigGauge { get; } 10 | ObservableGauge NodeGauge { get; } 11 | Counter PullAppConfigCounter { get; } 12 | ObservableGauge ServiceGauge { get; } 13 | 14 | void Start(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/AppAuthVM.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics.CodeAnalysis; 3 | 4 | namespace AgileConfig.Server.Apisite.Models 5 | { 6 | [ExcludeFromCodeCoverage] 7 | public class AppAuthVM: IAppIdModel 8 | { 9 | public List EditConfigPermissionUsers { get; set; } 10 | 11 | public List PublishConfigPermissionUsers { get; set; } 12 | 13 | public string AppId { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/ChangePasswordVM.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace AgileConfig.Server.Apisite.Models 4 | { 5 | [ExcludeFromCodeCoverage] 6 | public class ChangePasswordVM 7 | { 8 | public string password { get; set; } 9 | 10 | public string confirmPassword { get; set; } 11 | 12 | public string oldPassword { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/EnvString.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Apisite.Models.Binders; 2 | using Microsoft.AspNetCore.Mvc; 3 | using System.Diagnostics.CodeAnalysis; 4 | 5 | namespace AgileConfig.Server.Apisite.Models 6 | { 7 | [ExcludeFromCodeCoverage] 8 | [ModelBinder(BinderType = typeof(EnvQueryStringBinder))] 9 | public class EnvString 10 | { 11 | public string Value { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/InitPasswordVM.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace AgileConfig.Server.Apisite.Models 4 | { 5 | [ExcludeFromCodeCoverage] 6 | public class InitPasswordVM 7 | { 8 | public string password { get; set; } 9 | 10 | public string confirmPassword { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/LoginVM.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace AgileConfig.Server.Apisite.Models 4 | { 5 | [ExcludeFromCodeCoverage] 6 | public class LoginVM 7 | { 8 | public string userName { get; set; } 9 | public string password { get; set; } 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/PublishLogVM.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace AgileConfig.Server.Apisite.Models 4 | { 5 | [ExcludeFromCodeCoverage] 6 | public class PublishLogVM: IAppIdModel 7 | { 8 | public string AppId { get; set; } 9 | public string Log { get; set; } 10 | 11 | public string[] Ids { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/SaveJsonVM.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace AgileConfig.Server.Apisite.Models 4 | { 5 | [ExcludeFromCodeCoverage] 6 | public class SaveJsonVM 7 | { 8 | /// 9 | /// 指示是否用补丁模式更新现有配置 10 | /// true(补丁模式): 只修改本次提交包含的配置项. 11 | /// false(全量模式,默认):所有不存在于本次提交中的现有配置项都会被删除. 12 | /// 13 | public bool isPatch { get; set; } 14 | public string json { get; set; } 15 | } 16 | 17 | [ExcludeFromCodeCoverage] 18 | public class SaveKVListVM 19 | { 20 | /// 21 | /// 指示是否用补丁模式更新现有配置 22 | /// true(补丁模式): 只修改本次提交包含的配置项. 23 | /// false(全量模式,默认):所有不存在于本次提交中的现有配置项都会被删除. 24 | /// 25 | public bool isPatch { get; set; } 26 | public string str { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/ServerNodeVM.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Diagnostics.CodeAnalysis; 5 | 6 | namespace AgileConfig.Server.Apisite.Models 7 | { 8 | [ExcludeFromCodeCoverage] 9 | public class ServerNodeVM 10 | { 11 | [Required(ErrorMessage = "节点地址不能为空")] 12 | [MaxLength(100, ErrorMessage = "节点地址长度不能超过100位")] 13 | public string Address { get; set; } 14 | 15 | [MaxLength(50, ErrorMessage = "备注长度不能超过50位")] 16 | public string Remark { get; set; } 17 | public NodeStatus Status { get; set; } 18 | public DateTime? LastEchoTime { get; set; } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/ServerStatusReport.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.IService; 2 | using System.Diagnostics.CodeAnalysis; 3 | 4 | namespace AgileConfig.Server.Apisite.Models 5 | { 6 | [ExcludeFromCodeCoverage] 7 | public class ServerStatusReport 8 | { 9 | public ClientInfos WebsocketCollectionReport { get; set; } 10 | 11 | public int AppCount { get; set; } 12 | 13 | public int ConfigCount { get; set; } 14 | 15 | public int NodeCount { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Models/UserVM.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Diagnostics.CodeAnalysis; 5 | 6 | namespace AgileConfig.Server.Apisite.Models 7 | { 8 | [ExcludeFromCodeCoverage] 9 | public class UserVM 10 | { 11 | [Required(ErrorMessage = "用户Id不能为空")] 12 | [MaxLength(36, ErrorMessage = "用户Id长度不能超过36位")] 13 | public string Id { get; set; } 14 | 15 | [Required(ErrorMessage = "用户名不能为空")] 16 | [MaxLength(50, ErrorMessage = "用户名长度不能超过50位")] 17 | public string UserName { get; set; } 18 | 19 | [Required(ErrorMessage = "密码不能为空")] 20 | [MaxLength(50, ErrorMessage = "密码长度不能超过50位")] 21 | public string Password { get; set; } 22 | 23 | [MaxLength(50, ErrorMessage = "团队长度不能超过50位")] 24 | public string Team { get; set; } 25 | 26 | public List UserRoles { get; set; } 27 | 28 | public List UserRoleNames { get; set; } 29 | 30 | public UserStatus Status { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:54550", 8 | "sslPort": 0 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "api/values", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "AgileConfig.Server.Apisite": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "home/index", 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | }, 27 | "applicationUrl": "http://localhost:5000" 28 | }, 29 | "Docker": { 30 | "commandName": "Docker", 31 | "launchBrowser": true, 32 | "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values", 33 | "publishAllPorts": true 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/UIExtension/UIFileBag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using NuGet.Common; 4 | 5 | namespace AgileConfig.Server.Apisite.UIExtension; 6 | 7 | internal class UiFileBag 8 | { 9 | private static readonly Dictionary ContentTypesMap = new() 10 | { 11 | {".html", "text/html; charset=utf-8"}, 12 | {".css", "text/css; charset=utf-8"}, 13 | {".js", "application/javascript"}, 14 | {".png", "image/png"}, 15 | {".svg", "image/svg+xml"}, 16 | {".json","application/json;charset=utf-8"}, 17 | {".ico","image/x-icon"}, 18 | {".ttf","application/octet-stream"}, 19 | {".otf","font/otf"}, 20 | {".woff","font/x-woff"}, 21 | {".woff2","application/octet-stream"}, 22 | }; 23 | public string FilePath { get; init; } 24 | public byte[] Data { get; init; } 25 | 26 | public string ExtType { get; init; } 27 | 28 | public string ContentType => ContentTypesMap[ExtType]; 29 | 30 | public DateTime LastModified { get; init; } 31 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Websocket/MessageHandlers/IMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Microsoft.AspNetCore.Http; 3 | 4 | namespace AgileConfig.Server.Apisite.Websocket.MessageHandlers; 5 | 6 | public interface IMessageHandler 7 | { 8 | bool Hit(HttpRequest request); 9 | Task Handle(string message, HttpRequest request, WebsocketClient client); 10 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/Websocket/MessageHandlers/WebsocketMessageHandlers.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using AgileConfig.Server.IService; 3 | 4 | namespace AgileConfig.Server.Apisite.Websocket.MessageHandlers; 5 | 6 | public class WebsocketMessageHandlers 7 | { 8 | public readonly List MessageHandlers; 9 | public WebsocketMessageHandlers(IConfigService configService, IRegisterCenterService registerCenterService, 10 | IServiceInfoService serviceInfoService) 11 | { 12 | MessageHandlers = 13 | [ 14 | new OldMessageHandler(configService), 15 | new MessageHandler(configService, registerCenterService, serviceInfoService) 16 | ]; 17 | } 18 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/nlog.config: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Apisite/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.Apisite/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/AgileConfig.Server.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/EfLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System; 3 | 4 | namespace AgileConfig.Server.Common 5 | { 6 | public class EfLoggerProvider : ILoggerProvider 7 | { 8 | public ILogger CreateLogger(string categoryName) 9 | { 10 | return new EfLogger(); 11 | } 12 | 13 | public void Dispose() 14 | { } 15 | 16 | private class EfLogger : ILogger 17 | { 18 | public bool IsEnabled(LogLevel logLevel) 19 | { 20 | return true; 21 | } 22 | 23 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) 24 | { 25 | Console.WriteLine(formatter(state, exception)); 26 | } 27 | 28 | public IDisposable BeginScope(TState state) 29 | { 30 | return null; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/Encrypt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | using System.Threading; 5 | 6 | namespace AgileConfig.Server.Common 7 | { 8 | public static class Encrypt 9 | { 10 | private static readonly ThreadLocal Md5Instance = new(MD5.Create); 11 | public static string Md5(string txt) 12 | { 13 | var inputBytes = Encoding.ASCII.GetBytes(txt); 14 | var hashBytes = Md5Instance.Value.ComputeHash(inputBytes); 15 | return Convert.ToHexString(hashBytes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/EnumExt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | 5 | namespace AgileConfig.Server.Common 6 | { 7 | public static class EnumExt 8 | { 9 | public static string ToDesc(this Enum e) 10 | { 11 | var fi = e.GetType().GetField(e.ToString()); 12 | if (fi == null) 13 | { 14 | return ""; 15 | } 16 | var attrs = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); 17 | if (attrs.Length != 0) 18 | { 19 | return attrs.First().Description; 20 | } 21 | else 22 | { 23 | return e.ToString(); 24 | } 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/EnvAccessor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System.Linq; 4 | 5 | namespace AgileConfig.Server.Common 6 | { 7 | public interface IEnvAccessor 8 | { 9 | string Env { get; } 10 | } 11 | 12 | public class EnvAccessor : IEnvAccessor 13 | { 14 | private readonly IHttpContextAccessor _httpContextAccessor; 15 | public EnvAccessor(IHttpContextAccessor httpContextAccessor) 16 | { 17 | _httpContextAccessor = httpContextAccessor; 18 | } 19 | public string Env 20 | { 21 | get 22 | { 23 | var env = _httpContextAccessor.HttpContext?.Request.Query["env"].FirstOrDefault(); 24 | return env; 25 | } 26 | } 27 | } 28 | 29 | public static class EnvAccessorServiceCollectionExtension 30 | { 31 | public static IServiceCollection AddEnvAccessor(this IServiceCollection services) 32 | { 33 | services.AddSingleton(); 34 | 35 | return services; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/EventBus/ITinyEventBus.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace AgileConfig.Server.Common.EventBus 4 | { 5 | public interface IEvent 6 | { 7 | } 8 | 9 | public interface IEventHandler : IEventHandler where TEvent : IEvent 10 | { 11 | } 12 | 13 | public interface IEventHandler 14 | { 15 | Task Handle(IEvent evt); 16 | } 17 | 18 | public interface ITinyEventBus 19 | { 20 | void Fire(TEvent evt) where TEvent : IEvent; 21 | void Register() 22 | where T : class, IEventHandler; 23 | } 24 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/EventBus/ServiceCollectionExt.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace AgileConfig.Server.Common.EventBus 4 | { 5 | public static class ServiceCollectionExt 6 | { 7 | public static IServiceCollection AddTinyEventBus(this IServiceCollection sc) 8 | { 9 | sc.AddSingleton(sp => 10 | new TinyEventBus(sc)); 11 | 12 | return sc; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/Global.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.Logging; 3 | 4 | namespace AgileConfig.Server.Common 5 | { 6 | public static class Global 7 | { 8 | public static IConfiguration Config { get; set; } 9 | 10 | public static ILoggerFactory LoggerFactory { get; set; } 11 | 12 | public const string DefaultHttpClientName = "Default"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/IEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AgileConfig.Server.Common 4 | { 5 | public interface IEntity 6 | { 7 | T Id { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/RestClient/IRestClient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Net.Http; 3 | using System.Threading.Tasks; 4 | 5 | namespace AgileConfig.Server.Common.RestClient 6 | { 7 | public interface IRestClient 8 | { 9 | Task GetAsync(string url, Dictionary headers = null); 10 | 11 | Task GetAsync(string url, Dictionary headers = null); 12 | 13 | Task PostAsync(string url, object data, Dictionary headers = null); 14 | 15 | Task PostAsync(string url, object data, Dictionary headers = null); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/RestClient/ServiceCollectionEx.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace AgileConfig.Server.Common.RestClient 4 | { 5 | public static class ServiceCollectionEx 6 | { 7 | public static void AddRestClient(this IServiceCollection sc) 8 | { 9 | sc.AddScoped(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Common/SystemSettings.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Common; 2 | 3 | public static class SystemSettings 4 | { 5 | public const string SuperAdminId = "super_admin"; 6 | public const string SuperAdminUserName = "admin"; 7 | 8 | public const string DefaultEnvironment = "DEV,TEST,STAGING,PROD"; 9 | public const string DefaultEnvironmentKey = "environment"; 10 | public const string DefaultJwtSecretKey = "jwtsecret"; 11 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/AgileConfig.Server.Data.Abstraction.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/DbConfig/DbConfigInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AgileConfig.Server.Data.Abstraction.DbProvider 8 | { 9 | public class DbConfigInfo : IDbConfigInfo 10 | { 11 | public DbConfigInfo(string env, string provider, string conn) 12 | { 13 | this.Env = env; 14 | this.Provider = provider; 15 | this.ConnectionString = conn; 16 | } 17 | public string Env { get; } 18 | 19 | public string Provider { get; } 20 | 21 | public string ConnectionString { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/DbConfig/IDbConfigInfo.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Abstraction.DbProvider 2 | { 3 | public interface IDbConfigInfo 4 | { 5 | string ConnectionString { get; } 6 | string Env { get; } 7 | 8 | string Provider { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/DbConfig/IDbConfigInfoFactory.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Abstraction.DbProvider 2 | { 3 | public interface IDbConfigInfoFactory 4 | { 5 | IDbConfigInfo GetConfigInfo(string env = ""); 6 | } 7 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/DbConfig/ServiceCollectionExtension.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction.DbProvider; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AgileConfig.Server.Data.Abstraction 10 | { 11 | public static class ServiceCollectionExtension 12 | { 13 | public static IServiceCollection AddDbConfigInfoFactory(this IServiceCollection sc) 14 | { 15 | sc.AddSingleton(); 16 | 17 | return sc; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IAppInheritancedRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IAppInheritancedRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IAppRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IAppRepository: IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IConfigPublishedRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IConfigPublishedRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IConfigRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IConfigRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IPublishDetailRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IPublishDetailRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IPublishTimelineRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IPublishTimelineRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Common; 2 | using System.Linq.Expressions; 3 | 4 | namespace AgileConfig.Server.Data.Abstraction 5 | { 6 | public interface IRepository : IDisposable where T : IEntity 7 | { 8 | Task> AllAsync(); 9 | Task GetAsync(T1 id); 10 | 11 | Task UpdateAsync(T entity); 12 | Task UpdateAsync(IList entities); 13 | 14 | Task DeleteAsync(T1 id); 15 | 16 | Task DeleteAsync(T entity); 17 | 18 | Task DeleteAsync(IList entities); 19 | 20 | Task InsertAsync(T entity); 21 | 22 | Task InsertAsync(IList entities); 23 | 24 | Task> QueryAsync(Expression> exp); 25 | 26 | Task> QueryPageAsync(Expression> exp, int pageIndex, int pageSize, 27 | string defaultSortField = "Id", string defaultSortType = "ASC"); 28 | 29 | Task CountAsync(Expression>? exp = null); 30 | 31 | IUow Uow { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IRepositoryServiceRegister.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | /// 6 | /// 如果新对接一种存储,需要实现此接口 7 | /// 8 | public interface IRepositoryServiceRegister 9 | { 10 | /// 11 | /// 根据 provider name 判断是否适合当前注册器 12 | /// 13 | /// 14 | /// 15 | bool IsSuit4Provider(string provider); 16 | 17 | /// 18 | /// 注册固定的仓储 19 | /// 20 | /// 21 | void AddFixedRepositories(IServiceCollection sc); 22 | 23 | /// 24 | /// 根据环境获取仓储 25 | /// 26 | /// 27 | /// 28 | /// 29 | /// 30 | T GetServiceByEnv(IServiceProvider sp, string env) where T : class; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IServerNodeRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IServerNodeRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IServiceInfoRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IServiceInfoRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/ISettingRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface ISettingRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/ISysInitRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction; 4 | 5 | public interface ISysInitRepository 6 | { 7 | /// 8 | /// get jwt token secret from db 9 | /// 10 | /// 11 | string? GetJwtTokenSecret(); 12 | 13 | /// 14 | /// get default environment from db 15 | /// 16 | /// 17 | string? GetDefaultEnvironmentFromDb(); 18 | 19 | /// 20 | /// save initialization setting 21 | /// 22 | /// 23 | void SaveInitSetting(Setting setting); 24 | 25 | /// 26 | /// Init super admin 27 | /// 28 | /// 29 | /// 30 | bool InitSa(string password); 31 | 32 | bool HasSa(); 33 | 34 | bool InitDefaultApp(string appName); 35 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/ISysLogRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface ISysLogRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IUow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AgileConfig.Server.Data.Abstraction 8 | { 9 | public interface IUow : IDisposable 10 | { 11 | void Begin(); 12 | 13 | Task SaveChangesAsync(); 14 | 15 | void Rollback(); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IUserAppAuthRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IUserAppAuthRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IUserRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IUserRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Abstraction/IUserRoleRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | 3 | namespace AgileConfig.Server.Data.Abstraction 4 | { 5 | public interface IUserRoleRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Entity/AgileConfig.Server.Data.Entity.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Entity/AppInheritanced.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Common; 2 | using FreeSql.DataAnnotations; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace AgileConfig.Server.Data.Entity 8 | { 9 | /// 10 | /// app继承关系 11 | /// 12 | [Table(Name = "agc_appInheritanced")] 13 | [OraclePrimaryKeyName("agc_appInheritanced_pk")] 14 | public class AppInheritanced : IEntity 15 | { 16 | [Column(Name = "id", StringLength = 36)] 17 | public string Id { get; set; } 18 | [Column(Name = "appid", StringLength = 36)] 19 | public string AppId { get; set; } 20 | [Column(Name = "inheritanced_appid", StringLength = 36)] 21 | public string InheritancedAppId { get; set; } 22 | [Column(Name = "sort")] 23 | public int Sort { get; set; } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Entity/Setting.cs: -------------------------------------------------------------------------------- 1 | using FreeSql.DataAnnotations; 2 | using System; 3 | using MongoDB.Bson.Serialization.Attributes; 4 | using AgileConfig.Server.Common; 5 | 6 | namespace AgileConfig.Server.Data.Entity 7 | { 8 | [Table(Name = "agc_setting")] 9 | [OraclePrimaryKeyName("agc_setting_pk")] 10 | public class Setting: IEntity 11 | { 12 | [Column(Name = "id", StringLength = 36)] 13 | public string Id { get; set; } 14 | 15 | [Column(Name = "value", StringLength = 200)] 16 | public string Value { get; set; } 17 | 18 | [Column(Name = "create_time")] 19 | [BsonDateTimeOptions(Kind = DateTimeKind.Local)] 20 | public DateTime CreateTime { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Entity/UserAppAuth.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Common; 2 | using FreeSql.DataAnnotations; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace AgileConfig.Server.Data.Entity 8 | { 9 | [Table(Name = "agc_user_app_auth")] 10 | [OraclePrimaryKeyName("agc_user_app_auth_pk")] 11 | public class UserAppAuth: IEntity 12 | { 13 | [Column(Name = "id", StringLength = 36)] 14 | public string Id { get; set; } 15 | 16 | [Column(Name = "app_id", StringLength = 36)] 17 | public string AppId { get; set; } 18 | 19 | [Column(Name = "user_id", StringLength = 36)] 20 | public string UserId { get; set; } 21 | 22 | [Column(Name = "permission", StringLength = 50)] 23 | public string Permission { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Freesql/EnvFreeSqlFactory.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Common; 2 | 3 | namespace AgileConfig.Server.Data.Freesql 4 | { 5 | public class EnvFreeSqlFactory : IFreeSqlFactory 6 | { 7 | private readonly IMyFreeSQL _freeSQL; 8 | 9 | public EnvFreeSqlFactory(IMyFreeSQL freeSQL) 10 | { 11 | this._freeSQL = freeSQL; 12 | } 13 | 14 | public IFreeSql Create(string env) 15 | { 16 | return _freeSQL.GetInstanceByEnv(env); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Freesql/FreeSqlDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AgileConfig.Server.Data.Freesql 7 | { 8 | public class FreeSqlDbContextFactory 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Freesql/IFreeSqlFactory.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Freesql 2 | { 3 | public interface IFreeSqlFactory 4 | { 5 | IFreeSql Create(string env = ""); 6 | } 7 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Freesql/IMyFreeSQL.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Freesql 2 | { 3 | public interface IMyFreeSQL 4 | { 5 | IFreeSql GetInstanceByEnv(string env); 6 | } 7 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Freesql/ServiceCollectionExt.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace AgileConfig.Server.Data.Freesql 5 | { 6 | public static class ServiceCollectionExt 7 | { 8 | public static void AddFreeSqlFactory(this IServiceCollection sc) 9 | { 10 | sc.AddScoped(); 11 | sc.AddSingleton(); 12 | sc.AddSingleton(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Mongodb/AgileConfig.Server.Data.Mongodb.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/AgileConfig.Server.Data.Repository.Freesql.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/AppInheritancedRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class AppInheritancedRepository : FreesqlRepository, IAppInheritancedRepository 8 | { 9 | private readonly IFreeSqlFactory freeSqlFactory; 10 | 11 | public AppInheritancedRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 12 | { 13 | this.freeSqlFactory = freeSqlFactory; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/AppRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class AppRepository : FreesqlRepository, IAppRepository 8 | { 9 | private readonly IFreeSqlFactory freeSqlFactory; 10 | 11 | public AppRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 12 | { 13 | this.freeSqlFactory = freeSqlFactory; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/ConfigPublishedRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class ConfigPublishedRepository : FreesqlRepository, IConfigPublishedRepository 8 | { 9 | private readonly IFreeSql freeSql; 10 | 11 | public ConfigPublishedRepository(IFreeSql freeSql) : base(freeSql) 12 | { 13 | this.freeSql = freeSql; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/ConfigRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class ConfigRepository : FreesqlRepository, IConfigRepository 8 | { 9 | private readonly IFreeSql freeSql; 10 | 11 | public ConfigRepository(IFreeSql freeSql) : base(freeSql) 12 | { 13 | this.freeSql = freeSql; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/PublishDetailRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class PublishDetailRepository : FreesqlRepository, IPublishDetailRepository 8 | { 9 | private readonly IFreeSql freeSql; 10 | 11 | public PublishDetailRepository(IFreeSql freeSql) : base(freeSql) 12 | { 13 | this.freeSql = freeSql; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/PublishTimelineRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class PublishTimelineRepository : FreesqlRepository, IPublishTimelineRepository 8 | { 9 | private readonly IFreeSql freeSql; 10 | 11 | public PublishTimelineRepository(IFreeSql freeSql) : base(freeSql) 12 | { 13 | this.freeSql = freeSql; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/ServerNodeRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class ServerNodeRepository : FreesqlRepository, IServerNodeRepository 8 | { 9 | private readonly IFreeSqlFactory freeSqlFactory; 10 | 11 | public ServerNodeRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 12 | { 13 | this.freeSqlFactory = freeSqlFactory; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/ServiceInfoRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class ServiceInfoRepository : FreesqlRepository, IServiceInfoRepository 8 | { 9 | private readonly IFreeSqlFactory freeSqlFactory; 10 | 11 | public ServiceInfoRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 12 | { 13 | this.freeSqlFactory = freeSqlFactory; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/SettingRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class SettingRepository : FreesqlRepository, ISettingRepository 8 | { 9 | private readonly IFreeSqlFactory freeSqlFactory; 10 | 11 | public SettingRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 12 | { 13 | this.freeSqlFactory = freeSqlFactory; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/SysLogRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class SysLogRepository : FreesqlRepository, ISysLogRepository 8 | { 9 | 10 | private readonly IFreeSqlFactory freeSqlFactory; 11 | 12 | public SysLogRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 13 | { 14 | this.freeSqlFactory = freeSqlFactory; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/UserAppAuthRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class UserAppAuthRepository : FreesqlRepository, IUserAppAuthRepository 8 | { 9 | 10 | private readonly IFreeSqlFactory freeSqlFactory; 11 | 12 | public UserAppAuthRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 13 | { 14 | this.freeSqlFactory = freeSqlFactory; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/UserRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class UserRepository : FreesqlRepository, IUserRepository 8 | { 9 | 10 | private readonly IFreeSqlFactory freeSqlFactory; 11 | 12 | public UserRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 13 | { 14 | this.freeSqlFactory = freeSqlFactory; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Freesql/UserRoleRepository.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Abstraction; 2 | using AgileConfig.Server.Data.Entity; 3 | using AgileConfig.Server.Data.Freesql; 4 | 5 | namespace AgileConfig.Server.Data.Repository.Freesql 6 | { 7 | public class UserRoleRepository : FreesqlRepository, IUserRoleRepository 8 | { 9 | private readonly IFreeSqlFactory freeSqlFactory; 10 | 11 | public UserRoleRepository(IFreeSqlFactory freeSqlFactory) : base(freeSqlFactory.Create()) 12 | { 13 | this.freeSqlFactory = freeSqlFactory; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/AgileConfig.Server.Data.Repository.Mongodb.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/AppInheritancedRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class AppInheritancedRepository : MongodbRepository, IAppInheritancedRepository 4 | { 5 | public AppInheritancedRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public AppInheritancedRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/AppRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class AppRepository: MongodbRepository, IAppRepository 4 | { 5 | public AppRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public AppRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/ConfigPublishedRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class ConfigPublishedRepository : MongodbRepository, IConfigPublishedRepository 4 | { 5 | public ConfigPublishedRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public ConfigPublishedRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/ConfigRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class ConfigRepository: MongodbRepository, IConfigRepository 4 | { 5 | public ConfigRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public ConfigRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/PublishDetailRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class PublishDetailRepository: MongodbRepository, IPublishDetailRepository 4 | { 5 | public PublishDetailRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public PublishDetailRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/PublishTimelineRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class PublishTimelineRepository: MongodbRepository, IPublishTimelineRepository 4 | { 5 | public PublishTimelineRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public PublishTimelineRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/ServerNodeRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class ServerNodeRepository: MongodbRepository, IServerNodeRepository 4 | { 5 | public ServerNodeRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public ServerNodeRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/ServiceInfoRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class ServiceInfoRepository: MongodbRepository, IServiceInfoRepository 4 | { 5 | public ServiceInfoRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public ServiceInfoRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/SettingRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class SettingRepository: MongodbRepository, ISettingRepository 4 | { 5 | public SettingRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public SettingRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/SysLogRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class SysLogRepository: MongodbRepository, ISysLogRepository 4 | { 5 | public SysLogRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public SysLogRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/UserAppAuthRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class UserAppAuthRepository: MongodbRepository, IUserAppAuthRepository 4 | { 5 | public UserAppAuthRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public UserAppAuthRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/UserRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class UserRepository: MongodbRepository, IUserRepository 4 | { 5 | public UserRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public UserRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/UserRoleRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.Data.Repository.Mongodb; 2 | 3 | public class UserRoleRepository: MongodbRepository, IUserRoleRepository 4 | { 5 | public UserRoleRepository(string? connectionString) : base(connectionString) 6 | { 7 | } 8 | 9 | [ActivatorUtilitiesConstructor] 10 | public UserRoleRepository(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Mongodb/Usings.cs: -------------------------------------------------------------------------------- 1 | global using AgileConfig.Server.Data.Abstraction; 2 | global using AgileConfig.Server.Data.Entity; 3 | global using AgileConfig.Server.Data.Mongodb; 4 | global using Microsoft.Extensions.Configuration; 5 | global using Microsoft.Extensions.DependencyInjection; -------------------------------------------------------------------------------- /src/AgileConfig.Server.Data.Repository.Selector/AgileConfig.Server.Data.Repository.Selector.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Event/AgileConfig.Server.Event.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Event/ServiceInfoStatusUpdateEvents.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Common.EventBus; 2 | 3 | namespace AgileConfig.Server.Event 4 | { 5 | public class ServiceRegisteredEvent : IEvent 6 | { 7 | public ServiceRegisteredEvent(string uniqueId) 8 | { 9 | UniqueId = uniqueId; 10 | } 11 | public string UniqueId { get; } 12 | } 13 | 14 | public class ServiceUnRegisterEvent : IEvent 15 | { 16 | public ServiceUnRegisterEvent(string uniqueId) 17 | { 18 | UniqueId = uniqueId; 19 | } 20 | public string UniqueId { get; } 21 | } 22 | 23 | public class ServiceStatusUpdateEvent : IEvent 24 | { 25 | public ServiceStatusUpdateEvent(string uniqueId) 26 | { 27 | UniqueId = uniqueId; 28 | } 29 | public string UniqueId { get; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.EventHandler/AgileConfig.Server.EventHandler.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/AgileConfig.Server.IService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IAdmBasicAuthService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | 3 | namespace AgileConfig.Server.IService 4 | { 5 | /// 6 | /// 基于管理员的认证 7 | /// 8 | public interface IAdmBasicAuthService : IBasicAuthService 9 | { 10 | (string,string) GetUserNamePassword(HttpRequest httpRequest); 11 | } 12 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IAppBasicAuthService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | 3 | namespace AgileConfig.Server.IService 4 | { 5 | /// 6 | /// 基于应用的认证 7 | /// 8 | public interface IAppBasicAuthService: IBasicAuthService 9 | { 10 | (string, string) GetAppIdSecret(HttpRequest httpRequest); 11 | } 12 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IBasicAuthService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using System.Threading.Tasks; 3 | 4 | namespace AgileConfig.Server.IService 5 | { 6 | public interface IBasicAuthService 7 | { 8 | Task ValidAsync(HttpRequest httpRequest); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IJwtService.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.IService; 2 | 3 | public interface IJwtService 4 | { 5 | string Issuer { get; } 6 | string Audience { get; } 7 | int ExpireSeconds { get; } 8 | string GetSecurityKey(); 9 | string GetToken(string userId, string userName, bool isAdmin); 10 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IRegisterCenterService.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System.Threading.Tasks; 3 | 4 | namespace AgileConfig.Server.IService 5 | { 6 | public interface IRegisterCenterService 7 | { 8 | Task RegisterAsync(ServiceInfo serviceInfo); 9 | 10 | Task UnRegisterAsync(string serviceUniqueId); 11 | 12 | Task UnRegisterByServiceIdAsync(string serviceId); 13 | 14 | Task ReceiveHeartbeatAsync(string serviceUniqueId); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IServerNodeService.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.IService 7 | { 8 | public interface IServerNodeService: IDisposable 9 | { 10 | Task GetAsync(string id); 11 | Task AddAsync(ServerNode node); 12 | 13 | Task JoinAsync(string ip, int port, string desc); 14 | 15 | Task DeleteAsync(ServerNode node); 16 | 17 | Task DeleteAsync(string nodeId); 18 | 19 | Task UpdateAsync(ServerNode node); 20 | 21 | Task> GetAllNodesAsync(); 22 | 23 | /// 24 | /// 根据appsettings里的nodes配置初始化服务器节点 25 | /// 26 | /// 27 | [Obsolete] 28 | Task InitWatchNodeAsync(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IServiceHealthCheckService.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AgileConfig.Server.IService 9 | { 10 | public interface IServiceHealthCheckService 11 | { 12 | Task StartCheckAsync(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IServiceInfoService.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq.Expressions; 5 | using System.Threading.Tasks; 6 | 7 | namespace AgileConfig.Server.IService 8 | { 9 | public interface IServiceInfoService: IDisposable 10 | { 11 | Task GetByUniqueIdAsync(string id); 12 | Task GetByServiceIdAsync(string serviceId); 13 | 14 | Task RemoveAsync(string id); 15 | 16 | Task UpdateServiceStatus(ServiceInfo service, ServiceStatus status); 17 | Task> GetAllServiceInfoAsync(); 18 | 19 | Task> GetOnlineServiceInfoAsync(); 20 | 21 | Task> GetOfflineServiceInfoAsync(); 22 | 23 | Task ServicesMD5(); 24 | 25 | Task ServicesMD5Cache(); 26 | 27 | Task> QueryAsync(Expression> exp); 28 | 29 | void ClearCache(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/ISysLogService.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.IService 7 | { 8 | public interface ISysLogService: IDisposable 9 | { 10 | Task AddSysLogAsync(SysLog log); 11 | 12 | Task AddRangeAsync(IEnumerable logs); 13 | 14 | 15 | Task> SearchPage(string appId, SysLogType? logType,DateTime? startTime, DateTime? endTime, int pageSize, int pageIndex); 16 | 17 | Task Count(string appId, SysLogType? logType, DateTime? startTime, DateTime? endTime); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/ISystemInitializationService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace AgileConfig.Server.IService; 4 | 5 | public interface ISystemInitializationService 6 | { 7 | bool TryInitDefaultApp(string appName = ""); 8 | 9 | bool TryInitSaPassword(string password = ""); 10 | 11 | bool HasSa(); 12 | 13 | bool TryInitJwtSecret(); 14 | 15 | bool TryInitDefaultEnvironment(); 16 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.IService/IUserService.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.Data.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AgileConfig.Server.IService 8 | { 9 | public interface IUserService: IDisposable 10 | { 11 | Task> GetAll(); 12 | Task GetUserAsync(string userId); 13 | 14 | Task> GetUsersByNameAsync(string userName); 15 | Task> GetUserRolesAsync(string userId); 16 | 17 | Task AddAsync(User user); 18 | 19 | Task DeleteAsync(User user); 20 | 21 | Task UpdateAsync(User user); 22 | 23 | 24 | Task UpdateUserRolesAsync(string userId, List roles); 25 | 26 | 27 | Task ValidateUserPassword(string userName, string password); 28 | 29 | Task> GetUsersByRoleAsync(Role role); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/AgileConfig.Server.OIDC.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/IOidcClient.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.OIDC 2 | { 3 | public interface IOidcClient 4 | { 5 | OidcSetting OidcSetting { get; } 6 | string GetAuthorizeUrl(); 7 | (string Id, string UserName) UnboxIdToken(string idToken); 8 | Task<(string IdToken, string accessToken)> Validate(string code); 9 | } 10 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/ServiceCollectionExt.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.OIDC.SettingProvider; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace AgileConfig.Server.OIDC 5 | { 6 | public static class ServiceCollectionExt 7 | { 8 | public static void AddOIDC(this IServiceCollection sc) 9 | { 10 | sc.AddSingleton(); 11 | sc.AddSingleton(); 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/SettingProvider/IOidcSettingProvider.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.OIDC.SettingProvider 2 | { 3 | public interface IOidcSettingProvider 4 | { 5 | OidcSetting GetSetting(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/TokenEndpointAuthMethods/BasicTokenEndpointAuthMethod.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Headers; 2 | using System.Text; 3 | 4 | namespace AgileConfig.Server.OIDC.TokenEndpointAuthMethods 5 | { 6 | internal class BasicTokenEndpointAuthMethod : ITokenEndpointAuthMethod 7 | { 8 | public (HttpContent HttpContent, string BasicAuthorizationString) GetAuthHttpContent(string code, OidcSetting oidcSetting) 9 | { 10 | var kvs = new List>() { 11 | new KeyValuePair("code", code), 12 | new KeyValuePair("grant_type", "authorization_code"), 13 | new KeyValuePair("redirect_uri", oidcSetting.RedirectUri) 14 | }; 15 | var httpContent = new FormUrlEncodedContent(kvs); 16 | 17 | var txt = $"{oidcSetting.ClientId}:{oidcSetting.ClientSecret}"; 18 | string authorizationString = Convert.ToBase64String(Encoding.UTF8.GetBytes(txt)); 19 | 20 | return (httpContent, authorizationString); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/TokenEndpointAuthMethods/ITokenEndpointAuthMethod.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.OIDC.TokenEndpointAuthMethods 2 | { 3 | internal interface ITokenEndpointAuthMethod 4 | { 5 | (HttpContent HttpContent, string BasicAuthorizationString) GetAuthHttpContent(string code, OidcSetting oidcSetting); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/TokenEndpointAuthMethods/NoneTokenEndpointAuthMethod.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace AgileConfig.Server.OIDC.TokenEndpointAuthMethods 4 | { 5 | internal class NoneTokenEndpointAuthMethod : ITokenEndpointAuthMethod 6 | { 7 | public (HttpContent HttpContent, string BasicAuthorizationString) GetAuthHttpContent(string code, OidcSetting oidcSetting) 8 | { 9 | var kvs = new List>() { 10 | new KeyValuePair("code", code), 11 | new KeyValuePair("grant_type", "authorization_code"), 12 | new KeyValuePair("redirect_uri", oidcSetting.RedirectUri) 13 | }; 14 | var httpContent = new FormUrlEncodedContent(kvs); 15 | 16 | return (httpContent, ""); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/TokenEndpointAuthMethods/PostTokenEndpointAuthMethod.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.OIDC.TokenEndpointAuthMethods 2 | { 3 | internal class PostTokenEndpointAuthMethod : ITokenEndpointAuthMethod 4 | { 5 | public (HttpContent HttpContent, string BasicAuthorizationString) GetAuthHttpContent(string code, OidcSetting oidcSetting) 6 | { 7 | var kvs = new List>() { 8 | new KeyValuePair("code", code), 9 | new KeyValuePair("grant_type", "authorization_code"), 10 | new KeyValuePair("redirect_uri", oidcSetting.RedirectUri), 11 | new KeyValuePair("client_id", oidcSetting.ClientId), 12 | new KeyValuePair("client_secret", oidcSetting.ClientSecret), 13 | }; 14 | var httpContent = new FormUrlEncodedContent(kvs); 15 | 16 | return (httpContent, ""); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.OIDC/TokenEndpointAuthMethods/TokenEndpointAuthMethodFactory.cs: -------------------------------------------------------------------------------- 1 | namespace AgileConfig.Server.OIDC.TokenEndpointAuthMethods 2 | { 3 | internal static class TokenEndpointAuthMethodFactory 4 | { 5 | public static ITokenEndpointAuthMethod Create(string methodName) 6 | { 7 | if (methodName == "client_secret_basic") 8 | { 9 | return new BasicTokenEndpointAuthMethod(); 10 | } 11 | else if (methodName == "client_secret_post") 12 | { 13 | return new PostTokenEndpointAuthMethod(); 14 | } 15 | else if (methodName == "none") 16 | { 17 | return new NoneTokenEndpointAuthMethod(); 18 | } 19 | else 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Service/AgileConfig.Server.Service.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.Service/EventRegisterService/ConfigStatusUpdateEventHandlersRegister.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.EventHandler; 2 | using AgileConfig.Server.IService; 3 | 4 | namespace AgileConfig.Server.Service.EventRegisterService; 5 | 6 | public class ConfigStatusUpdateEventHandlersRegister : IEventHandlerRegister 7 | { 8 | private readonly Common.EventBus.ITinyEventBus _tinyEventBus; 9 | 10 | public ConfigStatusUpdateEventHandlersRegister(Common.EventBus.ITinyEventBus tinyEventBus) 11 | { 12 | _tinyEventBus = tinyEventBus; 13 | } 14 | 15 | public void Register() 16 | { 17 | _tinyEventBus.Register(); 18 | _tinyEventBus.Register(); 19 | } 20 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Service/EventRegisterService/EventHandlerRegister.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using AgileConfig.Server.IService; 3 | 4 | namespace AgileConfig.Server.Service.EventRegisterService; 5 | 6 | public class EventHandlerRegister(SystemEventHandlersRegister sysLogRegister, 7 | ConfigStatusUpdateEventHandlersRegister configStatusUpdateRegister, 8 | ServiceInfoStatusUpdateEventHandlersRegister serviceInfoStatusUpdateRegister 9 | ) : IEventHandlerRegister 10 | { 11 | private readonly IEventHandlerRegister? _sysLogRegister = sysLogRegister; 12 | private readonly IEventHandlerRegister? _configStatusUpdateRegister = configStatusUpdateRegister; 13 | private readonly IEventHandlerRegister? _serviceInfoStatusUpdateRegister = serviceInfoStatusUpdateRegister; 14 | 15 | public void Register() 16 | { 17 | _configStatusUpdateRegister?.Register(); 18 | _sysLogRegister?.Register(); 19 | _serviceInfoStatusUpdateRegister?.Register(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.Service/EventRegisterService/ServiceInfoStatusUpdateEventHandlersRegister.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Net; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | using Agile.Config.Protocol; 7 | using AgileConfig.Server.EventHandler; 8 | using AgileConfig.Server.IService; 9 | 10 | namespace AgileConfig.Server.Service.EventRegisterService; 11 | 12 | public class ServiceInfoStatusUpdateEventHandlersRegister : IEventHandlerRegister 13 | { 14 | 15 | private readonly Common.EventBus.ITinyEventBus _tinyEventBus; 16 | 17 | public ServiceInfoStatusUpdateEventHandlersRegister(Common.EventBus.ITinyEventBus tinyEventBus) 18 | { 19 | _tinyEventBus = tinyEventBus; 20 | } 21 | 22 | public void Register() 23 | { 24 | _tinyEventBus.Register(); 25 | _tinyEventBus.Register(); 26 | _tinyEventBus.Register(); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/.eslintignore: -------------------------------------------------------------------------------- 1 | /lambda/ 2 | /scripts 3 | /config 4 | .history 5 | public 6 | dist 7 | .umi 8 | mock -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [require.resolve('@umijs/fabric/dist/eslint')], 3 | globals: { 4 | ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, 5 | page: true, 6 | REACT_APP_ENV: true, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | **/node_modules 5 | # roadhog-api-doc ignore 6 | /src/utils/request-temp.js 7 | _roadhog-api-doc 8 | 9 | # production 10 | /dist 11 | /.vscode 12 | 13 | # misc 14 | .DS_Store 15 | npm-debug.log* 16 | yarn-error.log 17 | 18 | /coverage 19 | .idea 20 | yarn.lock 21 | *bak 22 | .vscode 23 | 24 | # visual studio code 25 | .history 26 | *.log 27 | functions/* 28 | .temp/** 29 | 30 | # umi 31 | .umi 32 | .umi-production 33 | 34 | # screenshot 35 | screenshot 36 | .firebase 37 | .eslintcache 38 | 39 | build 40 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.svg 2 | package.json 3 | .umi 4 | .umi-production 5 | /dist 6 | .dockerignore 7 | .DS_Store 8 | .eslintignore 9 | *.png 10 | *.toml 11 | docker 12 | .editorconfig 13 | Dockerfile* 14 | .gitignore 15 | .prettierignore 16 | LICENSE 17 | .eslintcache 18 | *.lock 19 | yarn-error.log 20 | .history 21 | CNAME 22 | /build 23 | /public -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/.prettierrc.js: -------------------------------------------------------------------------------- 1 | const fabric = require('@umijs/fabric'); 2 | 3 | module.exports = { 4 | ...fabric.prettier, 5 | }; 6 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/.stylelintrc.js: -------------------------------------------------------------------------------- 1 | const fabric = require('@umijs/fabric'); 2 | 3 | module.exports = { 4 | ...fabric.stylelint, 5 | }; 6 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/README.md: -------------------------------------------------------------------------------- 1 | # Ant Design Pro 2 | 3 | This project is initialized with [Ant Design Pro](https://pro.ant.design). Follow is the quick guide for how to use. 4 | 5 | ## Environment Prepare 6 | 7 | Install `node_modules`: 8 | 9 | ```bash 10 | npm install 11 | ``` 12 | 13 | or 14 | 15 | ```bash 16 | yarn 17 | ``` 18 | 19 | ## Provided Scripts 20 | 21 | Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test. 22 | 23 | Scripts provided in `package.json`. It's safe to modify or add additional script: 24 | 25 | ### Start project 26 | 27 | ```bash 28 | npm start 29 | ``` 30 | 31 | ### Build project 32 | 33 | ```bash 34 | npm run build 35 | ``` 36 | 37 | ### Check code style 38 | 39 | ```bash 40 | npm run lint 41 | ``` 42 | 43 | You can also use script to auto fix some lint error: 44 | 45 | ```bash 46 | npm run lint:fix 47 | ``` 48 | 49 | ### Test code 50 | 51 | ```bash 52 | npm test 53 | ``` 54 | 55 | ## More 56 | 57 | You can view full document on our [official website](https://pro.ant.design). And welcome any feedback in our [github](https://github.com/ant-design/ant-design-pro). 58 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/config/config.dev.ts: -------------------------------------------------------------------------------- 1 | // https://umijs.org/config/ 2 | import { defineConfig } from 'umi'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | // https://github.com/zthxxx/react-dev-inspector 7 | 'react-dev-inspector/plugins/umi/react-inspector', 8 | ], 9 | // https://github.com/zthxxx/react-dev-inspector#inspector-loader-props 10 | inspectorConfig: { 11 | exclude: [], 12 | babelPlugins: [], 13 | babelOptions: {}, 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/config/defaultSettings.ts: -------------------------------------------------------------------------------- 1 | import { Settings as ProSettings } from '@ant-design/pro-layout'; 2 | 3 | type DefaultSettings = Partial & { 4 | pwa: boolean; 5 | }; 6 | 7 | const proSettings: DefaultSettings ={ 8 | "navTheme": "light", 9 | "primaryColor": "#1890ff", 10 | "layout": "mix", 11 | "contentWidth": "Fluid", 12 | "fixedHeader": false, 13 | "fixSiderbar": true, 14 | "title": "AgileConfig", 15 | "pwa": false, 16 | "iconfontUrl": "", 17 | "menu": { 18 | "locale": true 19 | }, 20 | "headerHeight": 48 21 | } 22 | 23 | export type { DefaultSettings }; 24 | 25 | export default proSettings; 26 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/config/proxy.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置 3 | * The agent cannot take effect in the production environment 4 | * so there is no configuration of the production environment 5 | * For details, please see 6 | * https://pro.ant.design/docs/deploy 7 | */ 8 | export default { 9 | dev: { 10 | '/api/': { 11 | target: 'https://preview.pro.ant.design', 12 | changeOrigin: true, 13 | pathRewrite: { '^': '' }, 14 | }, 15 | }, 16 | test: { 17 | '/api/': { 18 | target: 'https://preview.pro.ant.design', 19 | changeOrigin: true, 20 | pathRewrite: { '^': '' }, 21 | }, 22 | }, 23 | pre: { 24 | '/api/': { 25 | target: 'your pre url', 26 | changeOrigin: true, 27 | pathRewrite: { '^': '' }, 28 | }, 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testURL: 'http://localhost:8000', 3 | testEnvironment: './tests/PuppeteerEnvironment', 4 | verbose: false, 5 | globals: { 6 | ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false, 7 | localStorage: null, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "emitDecoratorMetadata": true, 4 | "experimentalDecorators": true, 5 | "baseUrl": ".", 6 | "paths": { 7 | "@/*": ["./src/*"] 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/mock/clients.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from 'express'; 2 | 3 | const getClients = (req: Request, resp: Response) => { 4 | const list = [ 5 | { 6 | appId: "cc", 7 | id: "77d21f83-e7cc-4006-881b-adb8698878b3", 8 | lastHeartbeatTime: "2021-02-18T14:51:49.8073044+08:00", 9 | } 10 | ]; 11 | 12 | resp.json({ 13 | current: 1, 14 | pageSize: 20, 15 | success: true, 16 | total:30, 17 | data: list 18 | }); 19 | } 20 | 21 | const reloadClientConfig = (req: Request, resp: Response) => { 22 | resp.json({ 23 | success: true, 24 | }); 25 | } 26 | 27 | const clientOffline = (req: Request, resp: Response) => { 28 | resp.json({ 29 | success: true, 30 | }); 31 | } 32 | 33 | export default { 34 | 'GET /report/ServerNodeClients': getClients, 35 | 'POST /RemoteServerProxy/Client_Reload': reloadClientConfig, 36 | 'POST /RemoteServerProxy/Client_Offline': clientOffline 37 | }; -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/mock/logs.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from 'express'; 2 | 3 | const getLogs = (req: Request, resp: Response) => { 4 | const list = []; 5 | for (let index = 0; index < 20; index++) { 6 | list.push({ 7 | appId:'cc', 8 | id: index++, 9 | logTime:'2021-02-07T00:55:51.3888328', 10 | logTxt: '删除配置【Key:type】【Value:sqlite】【Group:store】【AppId:test_app】', 11 | logType: 0 12 | }); 13 | } 14 | 15 | resp.json({ 16 | current: 1, 17 | pageSize: 20, 18 | success: true, 19 | total:30, 20 | data: list 21 | }); 22 | } 23 | 24 | export default { 25 | 'GET /syslog/search': getLogs, 26 | }; -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/mock/route.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/auth_routes': { 3 | '/form/advanced-form': { authority: ['admin', 'user'] }, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/CNAME: -------------------------------------------------------------------------------- 1 | agile.config -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/public/favicon.ico -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/home_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/public/home_bg.png -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/icons/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/public/icons/icon-128x128.png -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/icons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/public/icons/icon-192x192.png -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/icons/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/public/icons/icon-512x512.png -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/monaco-editor/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 - present Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/public/monaco-editor/min/vs/base/browser/ui/codicons/codicon/codicon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/public/monaco-editor/min/vs/base/browser/ui/codicons/codicon/codicon.ttf -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/assets/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/assets/avatar.png -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/assets/logo.png -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/Authorized/Authorized.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Result } from 'antd'; 3 | import check from './CheckPermissions'; 4 | import type { IAuthorityType } from './CheckPermissions'; 5 | import type AuthorizedRoute from './AuthorizedRoute'; 6 | import type Secured from './Secured'; 7 | 8 | type AuthorizedProps = { 9 | authority: IAuthorityType; 10 | noMatch?: React.ReactNode; 11 | }; 12 | 13 | type IAuthorizedType = React.FunctionComponent & { 14 | Secured: typeof Secured; 15 | check: typeof check; 16 | AuthorizedRoute: typeof AuthorizedRoute; 17 | }; 18 | 19 | const Authorized: React.FunctionComponent = ({ 20 | children, 21 | authority, 22 | noMatch = ( 23 | 28 | ), 29 | }) => { 30 | const childrenRender: React.ReactNode = typeof children === 'undefined' ? null : children; 31 | const dom = check(authority, childrenRender, noMatch); 32 | return <>{dom}; 33 | }; 34 | 35 | export default Authorized as IAuthorizedType; 36 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/Authorized/AuthorizedElement.tsx: -------------------------------------------------------------------------------- 1 | import { getFunctions } from '@/utils/authority'; 2 | import React from 'react'; 3 | type AuthorizedProps = { 4 | appId?: string, 5 | authority?: string[], 6 | judgeKey: string, 7 | noMatch?: React.ReactNode; 8 | }; 9 | 10 | export const checkUserPermission = (functions:string[],judgeKey:string, appid:string|undefined)=>{ 11 | let appId = ''; 12 | if (appid) { 13 | appId = appid ; 14 | } 15 | let matchKey = ('GLOBAL_'+ judgeKey); 16 | let key = functions.find(x=>x === matchKey); 17 | if (key) return true; 18 | 19 | matchKey = ('APP_'+ appId + '_' + judgeKey); 20 | key = functions.find(x=>x === matchKey); 21 | if (key) return true; 22 | 23 | return false; 24 | } 25 | 26 | const AuthorizedEle: React.FunctionComponent = (props)=>{ 27 | 28 | let functions:string[] = []; 29 | if (props.authority) { 30 | functions = props.authority; 31 | } else { 32 | functions = getFunctions(); 33 | } 34 | 35 | return checkUserPermission(functions,props.judgeKey,props?.appId)? <>{props.children} : <>{props.noMatch} 36 | }; 37 | 38 | export default AuthorizedEle; 39 | 40 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/Authorized/AuthorizedRoute.tsx: -------------------------------------------------------------------------------- 1 | import { Redirect, Route } from 'umi'; 2 | 3 | import React from 'react'; 4 | import Authorized from './Authorized'; 5 | import type { IAuthorityType } from './CheckPermissions'; 6 | 7 | type AuthorizedRouteProps = { 8 | currentAuthority: string; 9 | component: React.ComponentClass; 10 | render: (props: any) => React.ReactNode; 11 | redirectPath: string; 12 | authority: IAuthorityType; 13 | }; 14 | 15 | const AuthorizedRoute: React.SFC = ({ 16 | component: Component, 17 | render, 18 | authority, 19 | redirectPath, 20 | ...rest 21 | }) => ( 22 | } />} 25 | > 26 | (Component ? : render(props))} 29 | /> 30 | 31 | ); 32 | 33 | export default AuthorizedRoute; 34 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/Authorized/index.tsx: -------------------------------------------------------------------------------- 1 | import Authorized from './Authorized'; 2 | import Secured from './Secured'; 3 | import check from './CheckPermissions'; 4 | import renderAuthorize from './renderAuthorize'; 5 | 6 | Authorized.Secured = Secured; 7 | Authorized.check = check; 8 | 9 | const RenderAuthorize = renderAuthorize(Authorized); 10 | 11 | export default RenderAuthorize; 12 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/Authorized/renderAuthorize.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable eslint-comments/disable-enable-pair */ 2 | /* eslint-disable import/no-mutable-exports */ 3 | let CURRENT: string | string[] = 'NULL'; 4 | 5 | type CurrentAuthorityType = string | string[] | (() => typeof CURRENT); 6 | /** 7 | * Use authority or getAuthority 8 | * 9 | * @param {string|()=>String} currentAuthority 10 | */ 11 | const renderAuthorize = (Authorized: T): ((currentAuthority: CurrentAuthorityType) => T) => ( 12 | currentAuthority: CurrentAuthorityType, 13 | ): T => { 14 | if (currentAuthority) { 15 | if (typeof currentAuthority === 'function') { 16 | CURRENT = currentAuthority(); 17 | } 18 | if ( 19 | Object.prototype.toString.call(currentAuthority) === '[object String]' || 20 | Array.isArray(currentAuthority) 21 | ) { 22 | CURRENT = currentAuthority as string[]; 23 | } 24 | } else { 25 | CURRENT = 'NULL'; 26 | } 27 | return Authorized; 28 | }; 29 | 30 | export { CURRENT }; 31 | export default (Authorized: T) => renderAuthorize(Authorized); 32 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/HeaderDropdown/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/es/style/themes/default.less'; 2 | 3 | .container > * { 4 | background-color: @popover-bg; 5 | border-radius: 4px; 6 | box-shadow: @shadow-1-down; 7 | } 8 | 9 | @media screen and (max-width: @screen-xs) { 10 | .container { 11 | width: 100% !important; 12 | } 13 | .container > * { 14 | border-radius: 0 !important; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/HeaderDropdown/index.tsx: -------------------------------------------------------------------------------- 1 | import type { DropDownProps } from 'antd/es/dropdown'; 2 | import { Dropdown } from 'antd'; 3 | import React from 'react'; 4 | import classNames from 'classnames'; 5 | import styles from './index.less'; 6 | 7 | export type HeaderDropdownProps = { 8 | overlayClassName?: string; 9 | overlay: React.ReactNode | (() => React.ReactNode) | any; 10 | placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter'; 11 | } & Omit; 12 | 13 | const HeaderDropdown: React.FC = ({ overlayClassName: cls, ...restProps }) => ( 14 | 15 | ); 16 | 17 | export default HeaderDropdown; 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/HeaderSearch/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/es/style/themes/default.less'; 2 | 3 | .headerSearch { 4 | .input { 5 | width: 0; 6 | min-width: 0; 7 | overflow: hidden; 8 | background: transparent; 9 | border-radius: 0; 10 | transition: width 0.3s, margin-left 0.3s; 11 | :global(.ant-select-selection) { 12 | background: transparent; 13 | } 14 | input { 15 | padding-right: 0; 16 | padding-left: 0; 17 | border: 0; 18 | box-shadow: none !important; 19 | } 20 | &, 21 | &:hover, 22 | &:focus { 23 | border-bottom: 1px solid @border-color-base; 24 | } 25 | &.show { 26 | width: 210px; 27 | margin-left: 8px; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/NoticeIcon/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/es/style/themes/default.less'; 2 | 3 | .popover { 4 | position: relative; 5 | width: 336px; 6 | } 7 | 8 | .noticeButton { 9 | display: inline-block; 10 | cursor: pointer; 11 | transition: all 0.3s; 12 | } 13 | .icon { 14 | padding: 4px; 15 | vertical-align: middle; 16 | } 17 | 18 | .badge { 19 | font-size: 16px; 20 | } 21 | 22 | .tabs { 23 | :global { 24 | .ant-tabs-nav-list { 25 | margin: auto; 26 | } 27 | 28 | .ant-tabs-nav-scroll { 29 | text-align: center; 30 | } 31 | .ant-tabs-bar { 32 | margin-bottom: 0; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/components/PageLoading/index.tsx: -------------------------------------------------------------------------------- 1 | import { PageLoading } from '@ant-design/pro-layout'; 2 | 3 | // loading components from code split 4 | // https://umijs.org/plugin/umi-plugin-react.html#dynamicimport 5 | export default PageLoading; 6 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/e2e/__mocks__/antd-pro-merge-less.js: -------------------------------------------------------------------------------- 1 | export default undefined; 2 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/layouts/BlankLayout.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Inspector } from 'react-dev-inspector'; 3 | 4 | const InspectorWrapper = process.env.NODE_ENV === 'development' ? Inspector : React.Fragment; 5 | 6 | const Layout: React.FC = ({ children }) => { 7 | return {children}; 8 | }; 9 | 10 | export default Layout; 11 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/layouts/compos/LayoutFooter.tsx: -------------------------------------------------------------------------------- 1 | import { getAppVer } from "@/utils/system"; 2 | import { GithubOutlined } from "@ant-design/icons" 3 | import React from "react" 4 | 5 | const LayoutFooter : React.FC =()=>{ 6 | return ( 7 |
13 | v 14 | { getAppVer()} 15 |    16 | 17 |   Powered by .NET8 ant-design-pro4 18 |
19 | ) 20 | } 21 | 22 | export default LayoutFooter; -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US.ts: -------------------------------------------------------------------------------- 1 | import component from './en-US/component'; 2 | import globalHeader from './en-US/globalHeader'; 3 | import menu from './en-US/menu'; 4 | import pwa from './en-US/pwa'; 5 | import settingDrawer from './en-US/settingDrawer'; 6 | import settings from './en-US/settings'; 7 | import pages from './en-US/pages'; 8 | import err_code from './en-US/err_code'; 9 | 10 | export default { 11 | 'navBar.lang': 'Languages', 12 | 'layout.user.link.help': 'Help', 13 | 'layout.user.link.privacy': 'Privacy', 14 | 'layout.user.link.terms': 'Terms', 15 | 'app.preview.down.block': 'Download this page to your local project', 16 | 'app.welcome.link.fetch-blocks': 'Get all block', 17 | 'app.welcome.link.block-list': 'Quickly build standard, pages based on `block` development', 18 | ...globalHeader, 19 | ...menu, 20 | ...settingDrawer, 21 | ...settings, 22 | ...pwa, 23 | ...component, 24 | ...pages, 25 | ...err_code 26 | }; 27 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': 'Expand', 3 | 'component.tagSelect.collapse': 'Collapse', 4 | 'component.tagSelect.all': 'All', 5 | }; 6 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/err_code.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'err_resetpassword_01':'Old password can not empty .', 3 | 'err_resetpassword_02':'Old password incorrect .', 4 | 'err_resetpassword_03':'New password can not empty .', 5 | 'err_resetpassword_04':'New password length can not over 50 .', 6 | 'err_resetpassword_05':'The different new passwords .', 7 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/globalHeader.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.globalHeader.search': 'Search', 3 | 'component.globalHeader.search.example1': 'Search example 1', 4 | 'component.globalHeader.search.example2': 'Search example 2', 5 | 'component.globalHeader.search.example3': 'Search example 3', 6 | 'component.globalHeader.help': 'Help', 7 | 'component.globalHeader.notification': 'Notification', 8 | 'component.globalHeader.notification.empty': 'You have viewed all notifications.', 9 | 'component.globalHeader.message': 'Message', 10 | 'component.globalHeader.message.empty': 'You have viewed all messsages.', 11 | 'component.globalHeader.event': 'Event', 12 | 'component.globalHeader.event.empty': 'You have viewed all events.', 13 | 'component.noticeIcon.clear': 'Clear', 14 | 'component.noticeIcon.cleared': 'Cleared', 15 | 'component.noticeIcon.empty': 'No notifications', 16 | 'component.noticeIcon.view-more': 'View more', 17 | }; 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': 'You are offline now', 3 | 'app.pwa.serviceworker.updated': 'New content is available', 4 | 'app.pwa.serviceworker.updated.hint': 'Please press the "Refresh" button to reload current page', 5 | 'app.pwa.serviceworker.updated.ok': 'Refresh', 6 | }; 7 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN.ts: -------------------------------------------------------------------------------- 1 | import component from './zh-CN/component'; 2 | import globalHeader from './zh-CN/globalHeader'; 3 | import menu from './zh-CN/menu'; 4 | import pwa from './zh-CN/pwa'; 5 | import settingDrawer from './zh-CN/settingDrawer'; 6 | import settings from './zh-CN/settings'; 7 | import pages from './zh-CN/pages'; 8 | import err_code from './zh-CN/err_code'; 9 | 10 | export default { 11 | 'navBar.lang': '语言', 12 | 'layout.user.link.help': '帮助', 13 | 'layout.user.link.privacy': '隐私', 14 | 'layout.user.link.terms': '条款', 15 | 'app.preview.down.block': '下载此页面到本地项目', 16 | 'app.welcome.link.fetch-blocks': '获取全部区块', 17 | 'app.welcome.link.block-list': '基于 block 开发,快速构建标准页面', 18 | ...pages, 19 | ...globalHeader, 20 | ...menu, 21 | ...settingDrawer, 22 | ...settings, 23 | ...pwa, 24 | ...component, 25 | ...err_code 26 | 27 | }; 28 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': '展开', 3 | 'component.tagSelect.collapse': '收起', 4 | 'component.tagSelect.all': '全部', 5 | }; 6 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/err_code.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'err_resetpassword_01':'原始密码不能为空', 3 | 'err_resetpassword_02':'原始密码错误,请重新再试', 4 | 'err_resetpassword_03':'新密码不能为空', 5 | 'err_resetpassword_04':'新密码最长不能超过50位', 6 | 'err_resetpassword_05':'输入的两次新密码不一致', 7 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/globalHeader.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.globalHeader.search': '站内搜索', 3 | 'component.globalHeader.search.example1': '搜索提示一', 4 | 'component.globalHeader.search.example2': '搜索提示二', 5 | 'component.globalHeader.search.example3': '搜索提示三', 6 | 'component.globalHeader.help': '使用文档', 7 | 'component.globalHeader.notification': '通知', 8 | 'component.globalHeader.notification.empty': '你已查看所有通知', 9 | 'component.globalHeader.message': '消息', 10 | 'component.globalHeader.message.empty': '您已读完所有消息', 11 | 'component.globalHeader.event': '待办', 12 | 'component.globalHeader.event.empty': '你已完成所有待办', 13 | 'component.noticeIcon.clear': '清空', 14 | 'component.noticeIcon.cleared': '清空了', 15 | 'component.noticeIcon.empty': '暂无数据', 16 | 'component.noticeIcon.view-more': '查看更多', 17 | }; 18 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': '当前处于离线状态', 3 | 'app.pwa.serviceworker.updated': '有新内容', 4 | 'app.pwa.serviceworker.updated.hint': '请点击“刷新”按钮或者手动刷新页面', 5 | 'app.pwa.serviceworker.updated.ok': '刷新', 6 | }; 7 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Agile Config", 3 | "short_name": "Agile Config", 4 | "display": "standalone", 5 | "start_url": "./?utm_source=homescreen", 6 | "theme_color": "#002140", 7 | "background_color": "#001529", 8 | "icons": [ 9 | { 10 | "src": "icons/icon-192x192.png", 11 | "sizes": "192x192" 12 | }, 13 | { 14 | "src": "icons/icon-128x128.png", 15 | "sizes": "128x128" 16 | }, 17 | { 18 | "src": "icons/icon-512x512.png", 19 | "sizes": "512x512" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/models/connect.d.ts: -------------------------------------------------------------------------------- 1 | import type { MenuDataItem, Settings as ProSettings } from '@ant-design/pro-layout'; 2 | import { GlobalModelState } from './global'; 3 | import { UserModelState } from './user'; 4 | import type { StateType } from './login'; 5 | 6 | export { GlobalModelState, UserModelState }; 7 | 8 | export type Loading = { 9 | global: boolean; 10 | effects: Record; 11 | models: { 12 | global?: boolean; 13 | menu?: boolean; 14 | setting?: boolean; 15 | user?: boolean; 16 | login?: boolean; 17 | }; 18 | }; 19 | 20 | export type ConnectState = { 21 | global: GlobalModelState; 22 | loading: Loading; 23 | settings: ProSettings; 24 | user: UserModelState; 25 | login: StateType; 26 | }; 27 | 28 | export type Route = { 29 | routes?: Route[]; 30 | } & MenuDataItem; 31 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/models/functionKeys.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | // public const string App_Add = "APP_ADD"; 3 | // public const string App_Edit = "APP_EDIT"; 4 | // public const string App_Delete = "APP_DELETE"; 5 | // public const string App_Auth = "APP_AUTH"; 6 | 7 | // public const string Config_Add = "CONFIG_ADD"; 8 | // public const string Config_Edit = "CONFIG_EDIT"; 9 | // public const string Config_Delete = "CONFIG_DELETE"; 10 | 11 | // public const string Config_Publish = "CONFIG_PUBLISH"; 12 | // public const string Config_Offline = "CONFIG_OFFLINE"; 13 | 14 | 15 | App_Add: 'APP_ADD', 16 | App_Edit: 'APP_EDIT', 17 | App_Delete: 'APP_DELETE', 18 | App_Auth: 'APP_AUTH', 19 | 20 | Config_Add: 'CONFIG_ADD', 21 | Config_Edit: 'CONFIG_EDIT', 22 | Config_Delete: 'CONFIG_DELETE', 23 | 24 | Config_Publish: 'CONFIG_PUBLISH', 25 | Config_Offline: 'CONFIG_OFFLINE', 26 | 27 | Node_Delete: 'NODE_DELETE', 28 | Node_Add: 'NODE_ADD', 29 | 30 | Client_Disconnect: 'CLIENT_DISCONNECT' 31 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/models/setting.ts: -------------------------------------------------------------------------------- 1 | import type { Reducer } from 'umi'; 2 | import type { DefaultSettings } from '../../config/defaultSettings'; 3 | import defaultSettings from '../../config/defaultSettings'; 4 | 5 | export type SettingModelType = { 6 | namespace: 'settings'; 7 | state: DefaultSettings; 8 | reducers: { 9 | changeSetting: Reducer; 10 | }; 11 | }; 12 | 13 | const updateColorWeak: (colorWeak: boolean) => void = (colorWeak) => { 14 | const root = document.getElementById('root'); 15 | if (root) { 16 | root.className = colorWeak ? 'colorWeak' : ''; 17 | } 18 | }; 19 | 20 | const SettingModel: SettingModelType = { 21 | namespace: 'settings', 22 | state: defaultSettings, 23 | reducers: { 24 | changeSetting(state = defaultSettings, { payload }) { 25 | const { colorWeak, contentWidth } = payload; 26 | 27 | if (state.contentWidth !== contentWidth && window.dispatchEvent) { 28 | window.dispatchEvent(new Event('resize')); 29 | } 30 | updateColorWeak(!!colorWeak); 31 | return { 32 | ...state, 33 | ...payload, 34 | }; 35 | }, 36 | }, 37 | }; 38 | export default SettingModel; 39 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/404.tsx: -------------------------------------------------------------------------------- 1 | import { Button, Result } from 'antd'; 2 | import React from 'react'; 3 | import { history } from 'umi'; 4 | 5 | const NoFoundPage: React.FC = () => ( 6 | history.push('/')}> 12 | Back Home 13 | 14 | } 15 | /> 16 | ); 17 | 18 | export default NoFoundPage; 19 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Apps/data.d.ts: -------------------------------------------------------------------------------- 1 | export type AppListItem = { 2 | id: string, 3 | name?: string, 4 | enabled?: boolean, 5 | inheritanced: boolean, 6 | inheritancedApps?: string[], 7 | inheritancedAppNames?: string[], 8 | secret?: string, 9 | createTime?: Date, 10 | updateTime?: Date 11 | appAdmin: string, 12 | appAdminName: string 13 | }; 14 | 15 | export type AppListParams = { 16 | id?: string; 17 | name?: string; 18 | pageSize?: number; 19 | current?: number; 20 | sortField: string; 21 | ascOrDesc: string; 22 | tableGrouped: boolean; 23 | }; 24 | 25 | export type AppListResult = { 26 | current: number 27 | data: AppListItem[] 28 | pageSize: number 29 | success: boolean 30 | total: number 31 | } 32 | 33 | export type UserAppAuth = { 34 | appId: string, 35 | editConfigPermissionUsers?: string[], 36 | publishConfigPermissionUsers?: string[] 37 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Apps/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Apps/index.less -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Clients/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Clients/index.less -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Clients/service.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function queryClients(params: any) { 4 | return request('report/SearchServerNodeClients', { 5 | params 6 | }); 7 | } 8 | 9 | export async function reloadClientConfigs(address: string, clientId: string) { 10 | return request('RemoteServerProxy/Client_Reload', { 11 | method: 'POST', 12 | params:{ 13 | address, 14 | clientId 15 | } 16 | }); 17 | } 18 | export async function clientOffline(address: string, clientId: string) { 19 | return request('RemoteServerProxy/Client_Offline', { 20 | method: 'POST', 21 | params:{ 22 | address, 23 | clientId 24 | } 25 | }); 26 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Configs/comps/jsonImport.less: -------------------------------------------------------------------------------- 1 | .action_bar { 2 | display: flex; 3 | justify-content: flex-end; 4 | padding-bottom: 24px; 5 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Configs/comps/versionHistory.less: -------------------------------------------------------------------------------- 1 | .historyContainer { 2 | max-Height:600px; 3 | overflow-y: scroll; 4 | scrollbar-Width:"none", 5 | } 6 | .historyContainer::-webkit-scrollbar { 7 | display: none; 8 | } 9 | .historyVersionTable { 10 | border:1px solid #d9d9d9; 11 | border-radius: 1px; 12 | padding: 10px 20px 20px 20px; 13 | margin-top: 20px; 14 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Configs/index.less: -------------------------------------------------------------------------------- 1 | .col_val { 2 | max-width: 400px; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Home/comps/latestVisitApps.tsx: -------------------------------------------------------------------------------- 1 | import { Card } from 'antd'; 2 | import { history } from 'umi'; 3 | import { useState } from 'react'; 4 | import { getVisitApps } from '@/utils/latestVisitApps'; 5 | 6 | const LatestVisitApps: React.FC = ()=> { 7 | const [latestVisitApps, _] = useState<{appId:string,appName:string}[]>(getVisitApps()); 8 | return( 9 | 25 | 26 | ); 27 | } 28 | 29 | export default LatestVisitApps; -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Home/comps/nodeClientStatiCharts.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Home/comps/nodeClientStatiCharts.tsx -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Home/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/es/style/themes/default.less'; 2 | .summary { 3 | display: flex; 4 | justify-content: space-around; 5 | align-items: center; 6 | .item { 7 | cursor: pointer; 8 | display: flex; 9 | justify-content: space-between; 10 | align-items: center; 11 | width: 100%; 12 | padding: 24px; 13 | border-radius: 5px; 14 | height: 100px; 15 | color: @white; 16 | .name { 17 | opacity: 0.65; 18 | font-size: 12px; 19 | } 20 | .icon { 21 | font-size: 20px; 22 | } 23 | .count { 24 | font-size: 20px; 25 | margin-bottom: 10px; 26 | } 27 | } 28 | } 29 | 30 | .node_clients { 31 | height: 200px; 32 | width: 100%; 33 | margin-top: 15px; 34 | } 35 | 36 | .panel { 37 | background-color: white; 38 | padding: 20px 20px; 39 | margin-bottom: 20px; 40 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Home/service.ts: -------------------------------------------------------------------------------- 1 | import request from "@/utils/request"; 2 | 3 | export async function queryAppcount() { 4 | return request('report/appcount'); 5 | } 6 | export async function queryConfigcount() { 7 | return request('report/configcount'); 8 | } 9 | export async function queryNodecount() { 10 | return request('report/nodecount'); 11 | } 12 | export async function queryServerNodeStatus() { 13 | return request('report/RemoteNodesStatus'); 14 | } 15 | export async function queryServiceCount() { 16 | return request('report/serviceCount'); 17 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Logs/data.d.ts: -------------------------------------------------------------------------------- 1 | export type LogListItem = { 2 | id: number; 3 | appId: string; 4 | logText: string; 5 | logTime: string; 6 | logType: number 7 | }; 8 | 9 | export type LogListParams = { 10 | appId?: number; 11 | logTime?: string; 12 | pageSize?: number; 13 | current?: number; 14 | }; 15 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Logs/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Logs/index.less -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Logs/service.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | import { LogListParams } from './data'; 3 | 4 | export async function queryLogs(params?: LogListParams) { 5 | console.log(params); 6 | return request('syslog/search', { 7 | params, 8 | }); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Nodes/data.d.ts: -------------------------------------------------------------------------------- 1 | export type NodeItem = { 2 | address: string, 3 | remark?: string, 4 | lastEchoTime?: Date, 5 | status: number, 6 | createTime?: Date 7 | }; 8 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Nodes/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Nodes/index.less -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Nodes/service.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | import { NodeItem } from './data'; 3 | 4 | export async function queryNodes() { 5 | return request('servernode/all', { 6 | }); 7 | } 8 | 9 | export async function addNode(params:NodeItem) { 10 | return request('servernode/add', { 11 | method: 'POST', 12 | data: { 13 | ...params 14 | } 15 | }); 16 | } 17 | 18 | export async function delNode(params:NodeItem) { 19 | return request('servernode/delete', { 20 | method: 'POST', 21 | data: { 22 | ...params 23 | } 24 | }); 25 | } 26 | 27 | export async function allClientReload(params:NodeItem) { 28 | return request('RemoteServerProxy/AllClients_Reload?address=' + params.address, { 29 | method: 'POST', 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/OIDC/data.d.ts: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/OIDC/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/es/style/themes/default.less'; 2 | 3 | .loading{ 4 | display: flex; 5 | align-items: center; 6 | justify-content: center; 7 | height: 100vh; 8 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/OIDC/service.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/pages/OIDC/service.ts -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Services/data.d.ts: -------------------------------------------------------------------------------- 1 | export type ServiceItem = { 2 | id: string, 3 | serviceId: string, 4 | serviceName: string, 5 | ip: string, 6 | port: number, 7 | checkUrl: string, 8 | alarmUrl: string, 9 | heartBeatMode: string 10 | }; 11 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Services/index.less: -------------------------------------------------------------------------------- 1 | .linkDanger { 2 | color: #ff4d4f; 3 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Services/service.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | import { ServiceItem } from './data'; 3 | 4 | export async function queryService(params: any) { 5 | return request('service/search', { 6 | params 7 | }); 8 | } 9 | 10 | export async function reloadClientConfigs(address: string, clientId: string) { 11 | return request('RemoteServerProxy/Client_Reload', { 12 | method: 'POST', 13 | params:{ 14 | address, 15 | clientId 16 | } 17 | }); 18 | } 19 | export async function clientOffline(address: string, clientId: string) { 20 | return request('RemoteServerProxy/Client_Offline', { 21 | method: 'POST', 22 | params:{ 23 | address, 24 | clientId 25 | } 26 | }); 27 | } 28 | 29 | export async function addService(service: ServiceItem) { 30 | return request('service/add', { 31 | method: 'POST', 32 | data:{ 33 | ...service 34 | } 35 | }); 36 | } 37 | 38 | export async function removeService(service: ServiceItem) { 39 | return request('service/remove', { 40 | method: 'POST', 41 | params:{ 42 | id: service.id 43 | } 44 | }); 45 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/data.d.ts: -------------------------------------------------------------------------------- 1 | export type UserItem = { 2 | id: string, 3 | userName: string, 4 | team: string, 5 | status: number, 6 | userRoles: number[], 7 | userRoleNames: string[] 8 | }; 9 | export type UserListParams = { 10 | name?: string; 11 | pageSize?: number; 12 | current?: number; 13 | }; -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/AgileConfig/f7a3e9cdbda26aaec03ac35bd1ae6c86ea3dcee1/src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/index.less -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/initPassword/data.d.ts: -------------------------------------------------------------------------------- 1 | export type InitPasswordModel = {password:string, confirmPassword:string} -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/initPassword/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/es/style/themes/default.less'; 2 | 3 | .main { 4 | width: 328px; 5 | margin: 0 auto; 6 | @media screen and (max-width: @screen-sm) { 7 | width: 95%; 8 | max-width: 328px; 9 | } 10 | 11 | :global { 12 | .@{ant-prefix}-tabs-nav-list { 13 | margin: auto; 14 | font-size: 16px; 15 | } 16 | } 17 | 18 | .icon { 19 | margin-left: 16px; 20 | color: rgba(0, 0, 0, 0.2); 21 | font-size: 24px; 22 | vertical-align: middle; 23 | cursor: pointer; 24 | transition: color 0.3s; 25 | 26 | &:hover { 27 | color: @primary-color; 28 | } 29 | } 30 | 31 | .other { 32 | margin-top: 24px; 33 | line-height: 22px; 34 | text-align: left; 35 | .register { 36 | float: right; 37 | } 38 | } 39 | 40 | .prefixIcon { 41 | color: @primary-color; 42 | font-size: @font-size-base; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/initPassword/service.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | import { InitPasswordModel } from './data'; 3 | 4 | export async function initPassword(model:InitPasswordModel) { 5 | return request('admin/InitPassword', { 6 | data: { 7 | ...model 8 | }, 9 | method: "POST" 10 | }); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/login/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/es/style/themes/default.less'; 2 | 3 | .main { 4 | width: 328px; 5 | margin: 0 auto; 6 | @media screen and (max-width: @screen-sm) { 7 | width: 95%; 8 | max-width: 328px; 9 | } 10 | 11 | :global { 12 | .@{ant-prefix}-tabs-nav-list { 13 | margin: auto; 14 | font-size: 16px; 15 | } 16 | } 17 | 18 | .icon { 19 | margin-left: 16px; 20 | color: rgba(0, 0, 0, 0.2); 21 | font-size: 24px; 22 | vertical-align: middle; 23 | cursor: pointer; 24 | transition: color 0.3s; 25 | 26 | &:hover { 27 | color: @primary-color; 28 | } 29 | } 30 | 31 | .other { 32 | margin-top: 24px; 33 | line-height: 22px; 34 | text-align: left; 35 | .register { 36 | float: right; 37 | } 38 | } 39 | 40 | .prefixIcon { 41 | color: @primary-color; 42 | font-size: @font-size-base; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/User/login/service.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function PasswordInited() { 4 | return request('admin/PasswordInited', { 5 | }); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/pages/Welcome.less: -------------------------------------------------------------------------------- 1 | @import '~antd/lib/style/themes/default.less'; 2 | 3 | .pre { 4 | margin: 12px 0; 5 | padding: 12px 20px; 6 | background: @input-bg; 7 | box-shadow: @card-shadow; 8 | } 9 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/services/login.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export type LoginParamsType = { 4 | userName: string; 5 | password: string; 6 | mobile: string; 7 | captcha: string; 8 | }; 9 | 10 | export async function accountLogin(params: LoginParamsType) { 11 | return request('admin/jwt/login', { 12 | method: 'POST', 13 | data: params, 14 | }); 15 | } 16 | 17 | export async function oidcLogin(code: string) { 18 | return request('admin/oidc/login', { 19 | method: 'GET', 20 | params: { 21 | code: code 22 | } 23 | }); 24 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/services/system.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function sys(): Promise { 4 | return request('Home/sys'); 5 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/services/user.ts: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export async function current(): Promise { 4 | return request('Home/current'); 5 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'slash2'; 2 | declare module '*.css'; 3 | declare module '*.less'; 4 | declare module '*.scss'; 5 | declare module '*.sass'; 6 | declare module '*.svg'; 7 | declare module '*.png'; 8 | declare module '*.jpg'; 9 | declare module '*.jpeg'; 10 | declare module '*.gif'; 11 | declare module '*.bmp'; 12 | declare module '*.tiff'; 13 | declare module 'omit.js'; 14 | 15 | // google analytics interface 16 | type GAFieldsObject = { 17 | eventCategory: string; 18 | eventAction: string; 19 | eventLabel?: string; 20 | eventValue?: number; 21 | nonInteraction?: boolean; 22 | }; 23 | 24 | interface Window { 25 | ga: ( 26 | command: 'send', 27 | hitType: 'event' | 'pageview', 28 | fieldsObject: GAFieldsObject | string, 29 | ) => void; 30 | reloadAuthorized: () => void; 31 | } 32 | 33 | declare let ga: () => void; 34 | 35 | // preview.pro.ant.design only do not use in your production ; 36 | // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 37 | declare let ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: 'site' | undefined; 38 | 39 | declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false; 40 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/utils/Authorized.ts: -------------------------------------------------------------------------------- 1 | import RenderAuthorize from '@/components/Authorized'; 2 | import { getAuthority } from './authority'; 3 | /* eslint-disable eslint-comments/disable-enable-pair */ 4 | /* eslint-disable import/no-mutable-exports */ 5 | let Authorized = RenderAuthorize(getAuthority()); 6 | 7 | // Reload the rights component 8 | const reloadAuthorized = (): void => { 9 | Authorized = RenderAuthorize(getAuthority()); 10 | }; 11 | 12 | /** Hard code block need it。 */ 13 | window.reloadAuthorized = reloadAuthorized; 14 | 15 | export { reloadAuthorized }; 16 | export default Authorized; 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/utils/latestVisitApps.ts: -------------------------------------------------------------------------------- 1 | export function saveVisitApp(appId:string, appName:string) { 2 | console.log('saveVisitApp', appId, appName); 3 | const apps = localStorage.getItem("latset_visit_apps"); 4 | if(apps) { 5 | const arr:{appId:string,appName:string}[] = JSON.parse(apps); 6 | 7 | const appIndex = arr.findIndex(x=>x.appId === appId); 8 | if (appIndex > -1) { 9 | arr.splice(appIndex, 1); 10 | } 11 | if (arr.length >= 4) { 12 | arr.splice(3, 1); 13 | } 14 | arr.unshift({ 15 | appId, 16 | appName 17 | }); 18 | localStorage.setItem('latset_visit_apps', JSON.stringify(arr)); 19 | } 20 | else{ 21 | localStorage.setItem('latset_visit_apps', JSON.stringify([{ 22 | appId,appName 23 | }])); 24 | } 25 | } 26 | 27 | export function getVisitApps() { 28 | const apps = localStorage.getItem("latset_visit_apps"); 29 | if(apps) { 30 | const arr:{appId:string,appName:string}[] = JSON.parse(apps); 31 | return arr; 32 | } 33 | return []; 34 | } -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/utils/system.ts: -------------------------------------------------------------------------------- 1 | export function setSysInfo(appver:string, envList:string[]) { 2 | localStorage.setItem('appver', appver); 3 | const json = JSON.stringify(envList); 4 | localStorage.setItem('envList', json); 5 | } 6 | export function getAppVer():string { 7 | let ver = localStorage.getItem('appver'); 8 | return ver ? ver: ''; 9 | } 10 | export function getEnvList():string[] { 11 | let envListJson = localStorage.getItem('envList'); 12 | if (envListJson) { 13 | return JSON.parse(envListJson); 14 | } 15 | return []; 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/utils/utils.less: -------------------------------------------------------------------------------- 1 | // mixins for clearfix 2 | // ------------------------ 3 | .clearfix() { 4 | zoom: 1; 5 | &::before, 6 | &::after { 7 | display: table; 8 | content: ' '; 9 | } 10 | &::after { 11 | clear: both; 12 | height: 0; 13 | font-size: 0; 14 | visibility: hidden; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/src/utils/utils.ts: -------------------------------------------------------------------------------- 1 | import { parse } from 'querystring'; 2 | 3 | /* eslint no-useless-escape:0 import/prefer-default-export:0 */ 4 | const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; 5 | 6 | export const isUrl = (path: string): boolean => reg.test(path); 7 | 8 | export const isAntDesignPro = (): boolean => { 9 | if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { 10 | return true; 11 | } 12 | return window.location.hostname === 'preview.pro.ant.design'; 13 | }; 14 | 15 | // 给官方演示站点用,用于关闭真实开发环境不需要使用的特性 16 | export const isAntDesignProOrDev = (): boolean => { 17 | const { NODE_ENV } = process.env; 18 | if (NODE_ENV === 'development') { 19 | return true; 20 | } 21 | return isAntDesignPro(); 22 | }; 23 | 24 | export const getPageQuery = () => parse(window.location.href.split('?')[1]); 25 | -------------------------------------------------------------------------------- /src/AgileConfig.Server.UI/react-ui-antd/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "build/dist", 4 | "module": "esnext", 5 | "target": "esnext", 6 | "lib": ["esnext", "dom"], 7 | "sourceMap": true, 8 | "baseUrl": ".", 9 | "jsx": "preserve", 10 | "allowSyntheticDefaultImports": true, 11 | "moduleResolution": "node", 12 | "forceConsistentCasingInFileNames": true, 13 | "noImplicitReturns": true, 14 | "suppressImplicitAnyIndexErrors": true, 15 | "noUnusedLocals": true, 16 | "allowJs": true, 17 | "skipLibCheck": true, 18 | "experimentalDecorators": true, 19 | "strict": true, 20 | "paths": { 21 | "@/*": ["./src/*"], 22 | "@@/*": ["./src/.umi/*"] 23 | } 24 | }, 25 | "include": [ 26 | "mock/**/*", 27 | "src/**/*", 28 | "tests/**/*", 29 | "test/**/*", 30 | "__test__/**/*", 31 | "typings/**/*", 32 | "config/**/*", 33 | ".eslintrc.js", 34 | ".stylelintrc.js", 35 | ".prettierrc.js", 36 | "jest.config.js", 37 | "mock/*" 38 | ], 39 | "exclude": ["node_modules", "build", "dist", "scripts", "src/.umi/*", "webpack", "jest"] 40 | } 41 | -------------------------------------------------------------------------------- /test/AgileConfig.Server.CommonTests/AgileConfig.Server.CommonTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/AgileConfig.Server.CommonTests/EncryptTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace AgileConfig.Server.Common.Tests; 5 | 6 | [TestClass] 7 | public class EncryptTests 8 | { 9 | private const string Origin = "123456"; 10 | private const string Expected = "E10ADC3949BA59ABBE56E057F20F883E"; 11 | 12 | [TestMethod] 13 | public void Md5Test() 14 | { 15 | var result = Encrypt.Md5(Origin); 16 | Assert.AreEqual(Expected, result); 17 | } 18 | 19 | [TestMethod] 20 | public void ParallelCallTest() 21 | { 22 | Parallel.For(0, 1000, _ => 23 | { 24 | var result = Encrypt.Md5(Origin); 25 | Assert.AreEqual(Expected, result); 26 | }); 27 | } 28 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.Data.AbstractionTests/AgileConfig.Server.Data.AbstractionTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/AgileConfig.Server.Data.FreesqlTests/AgileConfig.Server.Data.FreesqlTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/oracle/AppServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System; 3 | using System.Collections.Generic; 4 | using AgileConfig.Server.ServiceTests.sqlite; 5 | using System.Threading.Tasks; 6 | 7 | namespace AgileConfig.Server.ServiceTests.oracle 8 | { 9 | public class AppServiceTests_oracle : AppServiceTests 10 | { 11 | string conn = "user id=x;password=x;data source=192.168.0.123/orcl"; 12 | 13 | 14 | public override Task> GetConfigurationData() 15 | { 16 | var dict = new Dictionary(); 17 | dict["db:provider"] = "oracle"; 18 | dict["db:conn"] = conn; 19 | 20 | 21 | return Task.FromResult(dict); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/oracle/ConfigServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.oracle 7 | { 8 | public class ConfigServiceTests_oracle : ConfigServiceTests 9 | { 10 | string conn = "user id=x;password=x;data source=192.168.0.123/orcl"; 11 | 12 | public override Task> GetConfigurationData() 13 | { 14 | return 15 | Task.FromResult( 16 | new Dictionary 17 | { 18 | {"db:provider","oracle" }, 19 | {"db:conn",conn } 20 | }); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/oracle/ServerNodeServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.oracle 7 | { 8 | public class ServerNodeServiceTests_oracle: ServerNodeServiceTests 9 | { 10 | string conn = "user id=x;password=x;data source=192.168.0.123/orcl"; 11 | 12 | public override Task> GetConfigurationData() 13 | { 14 | return 15 | Task.FromResult( 16 | new Dictionary 17 | { 18 | {"db:provider","oracle" }, 19 | {"db:conn",conn } 20 | }); 21 | } 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/oracle/SettingServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.oracle 7 | { 8 | public class SettingServiceTests_oracle : SettingServiceTests 9 | { 10 | string conn = "user id=x;password=x;data source=192.168.0.123/orcl"; 11 | 12 | public override Task> GetConfigurationData() 13 | { 14 | return 15 | Task.FromResult( 16 | new Dictionary 17 | { 18 | {"db:provider","oracle" }, 19 | {"db:conn",conn } 20 | }); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/oracle/SysLogServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.oracle 7 | { 8 | public class SysLogServiceTests_oracle : SysLogServiceTests 9 | { 10 | 11 | string conn = "user id=x;password=x;data source=192.168.0.123/orcl"; 12 | 13 | public override Task> GetConfigurationData() 14 | { 15 | return 16 | Task.FromResult( 17 | new Dictionary 18 | { 19 | {"db:provider","oracle" }, 20 | {"db:conn",conn } 21 | }); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/sqlserver/AppServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.sqlserver 7 | { 8 | public class AppServiceTests_sqlserver : AppServiceTests 9 | { 10 | string conn = "TrustServerCertificate=True;Persist Security Info = False; User ID =dev; Password =dev; Initial Catalog =agile_config_test; Server =."; 11 | 12 | public override Task> GetConfigurationData() 13 | { 14 | var dict = new Dictionary(); 15 | dict["db:provider"] = "sqlserver"; 16 | dict["db:conn"] = conn; 17 | 18 | 19 | return Task.FromResult(dict); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/sqlserver/ConfigServiceTests.cs: -------------------------------------------------------------------------------- 1 | using AgileConfig.Server.ServiceTests.sqlite; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.sqlserver 7 | { 8 | public class ConfigServiceTests_sqlserver: ConfigServiceTests 9 | { 10 | string conn = "TrustServerCertificate=True;Persist Security Info = False; User ID =dev; Password =dev; Initial Catalog =agile_config_test; Server =."; 11 | 12 | public override Task> GetConfigurationData() 13 | { 14 | return 15 | Task.FromResult( 16 | new Dictionary 17 | { 18 | {"db:provider","sqlserver" }, 19 | {"db:conn",conn } 20 | }); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/sqlserver/ServerNodeServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.sqlserver 7 | { 8 | public class ServerNodeServiceTests_sqlserver: ServerNodeServiceTests 9 | { 10 | string conn = "TrustServerCertificate=True;Persist Security Info = False; User ID =dev; Password =dev; Initial Catalog =agile_config_test; Server =."; 11 | 12 | public override Task> GetConfigurationData() 13 | { 14 | return 15 | Task.FromResult( 16 | new Dictionary 17 | { 18 | {"db:provider","sqlserver" }, 19 | {"db:conn",conn } 20 | }); 21 | } 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/sqlserver/SettingServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.sqlserver 7 | { 8 | public class SettingServiceTests_sqlserver : SettingServiceTests 9 | { 10 | string conn = "TrustServerCertificate=True;Persist Security Info = False; User ID =dev; Password =dev; Initial Catalog =agile_config_test; Server =."; 11 | 12 | public override Task> GetConfigurationData() 13 | { 14 | return 15 | Task.FromResult( 16 | new Dictionary 17 | { 18 | {"db:provider","sqlserver" }, 19 | {"db:conn",conn } 20 | }); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /test/AgileConfig.Server.ServiceTests/sqlserver/SysLogServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using AgileConfig.Server.ServiceTests.sqlite; 4 | using System.Threading.Tasks; 5 | 6 | namespace AgileConfig.Server.ServiceTests.sqlserver 7 | { 8 | public class SysLogServiceTests_sqlserver : SysLogServiceTests 9 | { 10 | 11 | string conn = "TrustServerCertificate=True;Persist Security Info = False; User ID =dev; Password =dev; Initial Catalog =agile_config_test; Server =."; 12 | 13 | public override Task> GetConfigurationData() 14 | { 15 | return 16 | Task.FromResult( 17 | new Dictionary 18 | { 19 | {"db:provider","sqlserver" }, 20 | {"db:conn",conn } 21 | }); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /test/ApiSiteTests/ApiSiteTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | all 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | --------------------------------------------------------------------------------