Skip to content

Commit

Permalink
Merge pull request #700 from mixcore/features/cleanup-startup
Browse files Browse the repository at this point in the history
cleanup config
  • Loading branch information
nhathoang989 authored Oct 8, 2023
2 parents 53d4f82 + 4fa39ce commit 0228380
Show file tree
Hide file tree
Showing 226 changed files with 11,552 additions and 6,242 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/develop_dev-mixcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Build and deploy ASP.Net Core app to Azure Web App - dev-mixcore
on:
push:
branches:
- develop
- features/cleanup-startup
workflow_dispatch:

jobs:
Expand Down
20 changes: 5 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,10 @@ ModelManifest.xml
.vscode/
*.db
src/applications/Mixcore/Properties/PublishProfiles/
src/shared/__pycache__/
src/applications/Mixcore/MixContent/cache
src/applications/Mixcore/MixContent/Temp
src/applications/Mixcore/MixContent/*.db
src/applications/Mixcore/MixContent/*.db-shm
src/applications/Mixcore/MixContent/*.db-wal
src/applications/Mixcore/logs/
src/applications/Mixcore/MixContent/
src/applications/**/PublishProfiles/
src/applications/**/mixcontent/
src/applications/**/ServiceDependencies/

src/applications/Mixcore/wwwroot/portal-apps/
src/test/__pycache__/
src/modules/**/MixContent
src/**/__pycache__/
src/**/logs/
13 changes: 7 additions & 6 deletions src/applications/Mixcore/Controllers/AppController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Mix.Database.Services;
using Mix.Lib.Interfaces;
using Mix.Lib.Services;
using Mix.Shared.Models.Configurations;
using Mix.Shared.Services;

namespace Mixcore.Controllers
Expand All @@ -13,16 +14,16 @@ public class AppController : MixControllerBase
protected readonly MixCmsContext CmsContext;
private readonly MixCacheService _cacheService;
private readonly DatabaseService _databaseService;

public AppController(
public AppController(
IHttpContextAccessor httpContextAccessor,
IPSecurityConfigService ipSecurityConfigService,
IMixCmsService mixCmsService,
DatabaseService databaseService,
MixCmsContext cmsContext,
MixCacheService cacheService,
IMixTenantService tenantService)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService)
IMixTenantService tenantService,
IConfiguration configuration)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration)
{
CmsContext = cmsContext;
Uow = new(CmsContext);
Expand All @@ -36,7 +37,7 @@ protected override void ValidateRequest()
base.ValidateRequest();

// If this site has not been inited yet
if (GlobalConfigService.Instance.AppSettings.IsInit)
if (GlobalConfig.IsInit)
{
IsValid = false;
if (string.IsNullOrEmpty(_databaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION)))
Expand All @@ -45,7 +46,7 @@ protected override void ValidateRequest()
}
else
{
var status = GlobalConfigService.Instance.AppSettings.InitStatus;
var status = GlobalConfig.InitStatus;
RedirectUrl = $"/init/step{status}";
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/applications/Mixcore/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public HomeController(
MixRepoDbRepository repoDbRepository,
IMixMetadataService metadataService,
MixCacheService cacheService,
IMixTenantService tenantService)
: base(httpContextAccessor, ipSecurityConfigService, mixCmsService, translator, databaseService, uow, cacheService, tenantService)
IMixTenantService tenantService,
IConfiguration configuration)
: base(httpContextAccessor, ipSecurityConfigService, mixCmsService, translator, databaseService, uow, cacheService, tenantService, configuration)
{
_repoDbRepository = repoDbRepository;
_metadataService = metadataService;
Expand All @@ -38,7 +39,7 @@ protected override void ValidateRequest()
base.ValidateRequest();

// If this site has not been inited yet
if (GlobalConfigService.Instance.AppSettings.IsInit)
if (GlobalConfig.IsInit)
{
IsValid = false;
if (string.IsNullOrEmpty(DatabaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION)))
Expand All @@ -47,7 +48,7 @@ protected override void ValidateRequest()
}
else
{
var status = GlobalConfigService.Instance.AppSettings.InitStatus;
var status = GlobalConfig.InitStatus;
RedirectUrl = $"/init/step{status}";
}
}
Expand Down
12 changes: 8 additions & 4 deletions src/applications/Mixcore/Controllers/InitController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Mix.Shared.Models.Configurations;
using Mix.Shared.Services;
using Mixcore.Domain.Constants;

Expand All @@ -7,30 +8,33 @@ namespace Mixcore.Controllers
public class InitController : MixControllerBase
{
private readonly MixEndpointService _mixEndpointService;
private readonly GlobalSettingsModel _globalConfig;
public InitController(
IHttpContextAccessor httpContextAccessor,
IMixCmsService mixCmsService,
IPSecurityConfigService ipSecurityConfigService,
MixEndpointService mixEndpointService,
IMixTenantService tenantService)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService)
IMixTenantService tenantService,
IConfiguration configuration)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration)
{
_mixEndpointService = mixEndpointService;
_globalConfig = configuration.GetSection(MixAppSettingsSection.GlobalSettings).Get<GlobalSettingsModel>()!;
}

[HttpGet]
[Route("init")]
[Route("init/{page}")]
public IActionResult Index(string page)
{
if (!GlobalConfigService.Instance.AppSettings.IsInit)
if (!_globalConfig.IsInit)
{
return Redirect("/");
}
else
{
page ??= "";
var initStatus = GlobalConfigService.Instance.AppSettings.InitStatus;
var initStatus = _globalConfig.InitStatus;

switch (initStatus)
{
Expand Down
5 changes: 3 additions & 2 deletions src/applications/Mixcore/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ public class PageController : MixControllerBase
private readonly MixRepoDbRepository _repoDbRepository;
private readonly IMixMetadataService _metadataService;

public PageController(IHttpContextAccessor httpContextAccessor, IPSecurityConfigService ipSecurityConfigService, IMixCmsService mixCmsService, DatabaseService databaseService, MixCmsContext cmsContext, MixRepoDbRepository repoDbRepository, IMixMetadataService metadataService, MixCacheService cacheService, IMixTenantService tenantService) :
base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService)
public PageController(IHttpContextAccessor httpContextAccessor, IPSecurityConfigService ipSecurityConfigService, IMixCmsService mixCmsService, DatabaseService databaseService, MixCmsContext cmsContext, MixRepoDbRepository repoDbRepository, IMixMetadataService metadataService, MixCacheService cacheService, IMixTenantService tenantService,
IConfiguration configuration) :
base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration)
{
CmsContext = cmsContext;
Uow = new(CmsContext);
Expand Down
5 changes: 3 additions & 2 deletions src/applications/Mixcore/Controllers/PortalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ public PortalController(
IHttpContextAccessor httpContextAccessor,
IMixCmsService mixCmsService,
DatabaseService databaseService, IPSecurityConfigService ipSecurityConfigService,
IMixTenantService tenantService)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService)
IMixTenantService tenantService,
IConfiguration configuration)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration)
{
_databaseService = databaseService;
}
Expand Down
5 changes: 3 additions & 2 deletions src/applications/Mixcore/Controllers/PostController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public PostController(
IMixMetadataService metadataService,
UnitOfWorkInfo<MixDbDbContext> dbUow,
MixCacheService cacheService,
IMixTenantService tenantService)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService)
IMixTenantService tenantService,
IConfiguration configuration)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration)
{
CmsContext = cmsContext;
Uow = new(CmsContext);
Expand Down
5 changes: 3 additions & 2 deletions src/applications/Mixcore/Controllers/SecurityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public SecurityController(
MixIdentityService idService,
TenantUserManager userManager,
MixEndpointService mixEndpointService,
IMixTenantService tenantService)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService)
IMixTenantService tenantService,
IConfiguration configuration)
: base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration)
{
_signInManager = signInManager;
_logger = logger;
Expand Down
8 changes: 5 additions & 3 deletions src/applications/Mixcore/Domain/Bases/MvcBaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public MvcBaseController(
DatabaseService databaseService,
UnitOfWorkInfo<MixCmsContext> uow,
MixCacheService cacheService,
IMixTenantService tenantService) : base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService)
IMixTenantService tenantService,
IConfiguration configuration) :
base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration)
{
Translator = translator;
DatabaseService = databaseService;
Expand All @@ -33,7 +35,7 @@ protected override void ValidateRequest()
base.ValidateRequest();

// If this site has not been inited yet
if (GlobalConfigService.Instance.AppSettings.IsInit)
if (GlobalConfig.IsInit)
{
IsValid = false;
if (string.IsNullOrEmpty(DatabaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION)))
Expand All @@ -42,7 +44,7 @@ protected override void ValidateRequest()
}
else
{
var status = GlobalConfigService.Instance.AppSettings.InitStatus;
var status = GlobalConfig.InitStatus;
RedirectUrl = $"/init/step{status}";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public PostContentViewModel()
{
}

public PostContentViewModel(MixPostContent entity, UnitOfWorkInfo uowInfo = null) : base(entity, uowInfo)
public PostContentViewModel(MixPostContent entity, UnitOfWorkInfo uowInfo) : base(entity, uowInfo)
{
}

Expand Down
19 changes: 0 additions & 19 deletions src/applications/Mixcore/Models/Cms/Sample/Aspnetroleclaim.cs

This file was deleted.

23 changes: 0 additions & 23 deletions src/applications/Mixcore/Models/Cms/Sample/Aspnetuserclaim.cs

This file was deleted.

23 changes: 0 additions & 23 deletions src/applications/Mixcore/Models/Cms/Sample/Aspnetuserlogin.cs

This file was deleted.

25 changes: 0 additions & 25 deletions src/applications/Mixcore/Models/Cms/Sample/Aspnetuserrole.cs

This file was deleted.

19 changes: 0 additions & 19 deletions src/applications/Mixcore/Models/Cms/Sample/Aspnetusertoken.cs

This file was deleted.

21 changes: 0 additions & 21 deletions src/applications/Mixcore/Models/Cms/Sample/Client.cs

This file was deleted.

Loading

0 comments on commit 0228380

Please sign in to comment.