Browse Source

Merge branch 'main' into EngincanV/admin-events

pull/53/head
Engincan VESKE 5 years ago
parent
commit
4b4a491b7c
  1. 30
      etc/azure/deploy-to-k8s.yml
  2. 37
      etc/azure/scripts/push-images.ps1
  3. 5
      etc/k8s/helm-chart/deploy-azure.ps1
  4. 4
      etc/k8s/helm-chart/deploy-staging.ps1
  5. 2
      etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml
  6. 2
      etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api.yaml
  7. 2
      etc/k8s/helm-chart/eventhub/charts/admin/templates/admin.yaml
  8. 2
      etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml
  9. 19
      etc/k8s/helm-chart/eventhub/charts/background-services/templates/background-services.yaml
  10. 2
      etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml
  11. 2
      etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml
  12. 1
      etc/k8s/helm-chart/eventhub/values.azure.yaml
  13. 1
      etc/k8s/helm-chart/eventhub/values.yaml
  14. 16
      etc/k8s/scripts/build-images.ps1
  15. 4
      src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs
  16. 60
      src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs
  17. 4
      src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs
  18. 21
      src/EventHub.IdentityServer/EventHubIdentityServerModule.cs
  19. 4
      src/EventHub.Web/EventHubWebModule.cs
  20. 2
      src/EventHub.Web/Menus/EventHubMenuContributor.cs
  21. 8
      src/EventHub.Web/Pages/Index.cshtml

30
etc/azure/deploy-to-k8s.yml

@ -1,20 +1,46 @@
variables:
version: $(Build.BuildId)
trigger: none trigger: none
pool: pool:
vmImage: 'windows-latest' vmImage: 'ubuntu-latest'
steps: steps:
- task: PowerShell@2 - task: PowerShell@2
displayName: Build docker images
inputs: inputs:
filePath: 'etc/k8s/scripts/build-images.ps1' filePath: 'etc/k8s/scripts/build-images.ps1'
arguments: '-version $(version)'
- task: Docker@2 - task: Docker@2
displayName: Login to ACR
inputs: inputs:
containerRegistry: 'volocr' containerRegistry: 'volocr'
command: 'login' command: 'login'
- task: PowerShell@2 - task: PowerShell@2
displayName: Push images to ACR
inputs: inputs:
filePath: 'etc/azure/scripts/push-images.ps1' filePath: 'etc/azure/scripts/push-images.ps1'
arguments: '-version $(version)'
- task: Kubernetes@1
displayName: Delete migrator job
continueOnError: true
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: 'volosoft (fe02ef9f-9e1c-4e40-b924-505981688dd8)'
azureResourceGroup: 'volo'
kubernetesCluster: 'volo'
namespace: 'eventhub'
command: 'delete'
arguments: 'job eh-az-dbmigrator'
secretType: 'dockerRegistry'
containerRegistryType: 'Azure Container Registry'
- task: HelmDeploy@0 - task: HelmDeploy@0
displayName: Helm deploy
inputs: inputs:
connectionType: 'Azure Resource Manager' connectionType: 'Azure Resource Manager'
azureSubscription: 'volosoft(fe02ef9f-9e1c-4e40-b924-505981688dd8)' azureSubscription: 'volosoft(fe02ef9f-9e1c-4e40-b924-505981688dd8)'
@ -27,4 +53,4 @@ steps:
chartName: 'etc/k8s/helm-chart/eventhub' chartName: 'etc/k8s/helm-chart/eventhub'
releaseName: 'eh-az' releaseName: 'eh-az'
valueFile: 'etc/k8s/helm-chart/eventhub/values.azure.yaml' valueFile: 'etc/k8s/helm-chart/eventhub/values.azure.yaml'
arguments: '--namespace eventhub --create-namespace' arguments: '--namespace eventhub --create-namespace --set global.eventHubImageVersion=$(version)'

37
etc/azure/scripts/push-images.ps1

@ -1,22 +1,31 @@
param ($version='latest')
az acr login --name volocr az acr login --name volocr
docker tag eventhub.dbmigrator:latest volocr.azurecr.io/eventhub.dbmigrator:latest docker tag eventhub.dbmigrator:$version volocr.azurecr.io/eventhub.dbmigrator:$version
docker push volocr.azurecr.io/eventhub.dbmigrator:latest docker push volocr.azurecr.io/eventhub.dbmigrator:$version
docker tag volocr.azurecr.io/eventhub.dbmigrator:$version volocr.azurecr.io/eventhub.dbmigrator:latest
docker tag eventhub.www:latest volocr.azurecr.io/eventhub.www:latest docker tag eventhub.www:$version volocr.azurecr.io/eventhub.www:$version
docker push volocr.azurecr.io/eventhub.www:latest docker push volocr.azurecr.io/eventhub.www:$version
docker tag volocr.azurecr.io/eventhub.www:$version volocr.azurecr.io/eventhub.www:latest
docker tag eventhub.api:latest volocr.azurecr.io/eventhub.api:latest docker tag eventhub.api:$version volocr.azurecr.io/eventhub.api:$version
docker push volocr.azurecr.io/eventhub.api:latest docker push volocr.azurecr.io/eventhub.api:$version
docker tag volocr.azurecr.io/eventhub.api:$version volocr.azurecr.io/eventhub.api:latest
docker tag eventhub.admin:latest volocr.azurecr.io/eventhub.admin:latest docker tag eventhub.admin:$version volocr.azurecr.io/eventhub.admin:$version
docker push volocr.azurecr.io/eventhub.admin:latest docker push volocr.azurecr.io/eventhub.admin:$version
docker tag volocr.azurecr.io/eventhub.admin:$version volocr.azurecr.io/eventhub.admin:latest
docker tag eventhub.admin-api:latest volocr.azurecr.io/eventhub.admin-api:latest docker tag eventhub.admin-api:$version volocr.azurecr.io/eventhub.admin-api:$version
docker push volocr.azurecr.io/eventhub.admin-api:latest docker push volocr.azurecr.io/eventhub.admin-api:$version
docker tag volocr.azurecr.io/eventhub.admin-api:$version volocr.azurecr.io/eventhub.admin-api:latest
docker tag eventhub.account:latest volocr.azurecr.io/eventhub.account:latest docker tag eventhub.account:$version volocr.azurecr.io/eventhub.account:$version
docker push volocr.azurecr.io/eventhub.account:latest docker push volocr.azurecr.io/eventhub.account:$version
docker tag volocr.azurecr.io/eventhub.account:$version volocr.azurecr.io/eventhub.account:latest
docker tag eventhub.background-services:latest volocr.azurecr.io/eventhub.background-services:latest docker tag eventhub.background-services:$version volocr.azurecr.io/eventhub.background-services:$version
docker push volocr.azurecr.io/eventhub.background-services:latest docker push volocr.azurecr.io/eventhub.background-services:$version
docker tag volocr.azurecr.io/eventhub.background-services:$version volocr.azurecr.io/eventhub.background-services:latest

5
etc/k8s/helm-chart/deploy-azure.ps1

@ -1 +1,4 @@
helm upgrade --install eh-az eventhub -f .\eventhub\values.azure.yaml --namespace eventhub --create-namespace param ($version='latest')
kubectl delete job eh-az-dbmigrator
helm upgrade --install eh-az eventhub -f .\eventhub\values.azure.yaml --namespace eventhub --create-namespace --set global.eventHubImageVersion=$version

4
etc/k8s/helm-chart/deploy-staging.ps1

@ -0,0 +1,4 @@
param ($version='latest')
kubectl delete job eh-st-dbmigrator
helm upgrade --install eh-st eventhub --namespace eventhub --create-namespace --set global.eventHubImageVersion=$version

2
etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml

@ -12,7 +12,7 @@ spec:
app: {{ .Release.Name }}-{{ .Chart.Name }} app: {{ .Release.Name }}-{{ .Chart.Name }}
spec: spec:
containers: containers:
- image: {{ .Values.containerImage }} - image: {{ .Values.containerImage }}:{{ .Values.global.eventHubImageVersion }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }} imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }} name: {{ .Release.Name }}-{{ .Chart.Name }}
ports: ports:

2
etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api.yaml

@ -12,7 +12,7 @@ spec:
app: {{ .Release.Name }}-{{ .Chart.Name }} app: {{ .Release.Name }}-{{ .Chart.Name }}
spec: spec:
containers: containers:
- image: {{ .Values.containerImage }} - image: {{ .Values.containerImage }}:{{ .Values.global.eventHubImageVersion }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }} imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }} name: {{ .Release.Name }}-{{ .Chart.Name }}
ports: ports:

2
etc/k8s/helm-chart/eventhub/charts/admin/templates/admin.yaml

@ -12,7 +12,7 @@ spec:
app: {{ .Release.Name }}-{{ .Chart.Name }} app: {{ .Release.Name }}-{{ .Chart.Name }}
spec: spec:
containers: containers:
- image: {{ .Values.containerImage }} - image: {{ .Values.containerImage }}:{{ .Values.global.eventHubImageVersion }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }} imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }} name: {{ .Release.Name }}-{{ .Chart.Name }}
ports: ports:

2
etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml

@ -12,7 +12,7 @@ spec:
app: {{ .Release.Name }}-{{ .Chart.Name }} app: {{ .Release.Name }}-{{ .Chart.Name }}
spec: spec:
containers: containers:
- image: {{ .Values.containerImage }} - image: {{ .Values.containerImage }}:{{ .Values.global.eventHubImageVersion }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }} imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }} name: {{ .Release.Name }}-{{ .Chart.Name }}
ports: ports:

19
etc/k8s/helm-chart/eventhub/charts/background-services/templates/background-services.yaml

@ -1,18 +1,21 @@
apiVersion: batch/v1 apiVersion: apps/v1
kind: Job kind: Deployment
metadata: metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }} name: {{ .Release.Name }}-{{ .Chart.Name }}
spec: spec:
activeDeadlineSeconds: 180 selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template: template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec: spec:
containers: containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }} - image: {{ .Values.containerImage }}:{{ .Values.global.eventHubImageVersion }}
image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }} imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
env: env:
{{ include "eventhub.global.env" . | indent 8 }} {{ include "eventhub.global.env" . | indent 8 }}
- name: "ConnectionStrings__Default" - name: "ConnectionStrings__Default"
value: {{ .Values.global.defaultConnString }} value: {{ .Values.global.defaultConnString }}
restartPolicy: Never
backoffLimit: 10

2
etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml

@ -8,7 +8,7 @@ spec:
spec: spec:
containers: containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }} - name: {{ .Release.Name }}-{{ .Chart.Name }}
image: {{ .Values.containerImage }} image: {{ .Values.containerImage }}:{{ .Values.global.eventHubImageVersion }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }} imagePullPolicy: {{ .Values.global.imagePullPolicy }}
env: env:
{{ include "eventhub.global.env" . | indent 8 }} {{ include "eventhub.global.env" . | indent 8 }}

2
etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml

@ -12,7 +12,7 @@ spec:
app: {{ .Release.Name }}-{{ .Chart.Name }} app: {{ .Release.Name }}-{{ .Chart.Name }}
spec: spec:
containers: containers:
- image: {{ .Values.containerImage }} - image: {{ .Values.containerImage }}:{{ .Values.global.eventHubImageVersion }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }} imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }} name: {{ .Release.Name }}-{{ .Chart.Name }}
ports: ports:

1
etc/k8s/helm-chart/eventhub/values.azure.yaml

@ -19,6 +19,7 @@ global:
internalAuthServerRequireHttpsMetadata: "false" internalAuthServerRequireHttpsMetadata: "false"
stringEncryptionDefaultPassPhrase: "TxVIZFPxK33czbbv" stringEncryptionDefaultPassPhrase: "TxVIZFPxK33czbbv"
imagePullPolicy: Always imagePullPolicy: Always
eventHubImageVersion: latest
account: account:
containerImage: "volocr.azurecr.io/eventhub.account" containerImage: "volocr.azurecr.io/eventhub.account"
api: api:

1
etc/k8s/helm-chart/eventhub/values.yaml

@ -19,6 +19,7 @@ global:
internalAuthServerRequireHttpsMetadata: "false" internalAuthServerRequireHttpsMetadata: "false"
stringEncryptionDefaultPassPhrase: "TxVIZFPxK33czbbv" stringEncryptionDefaultPassPhrase: "TxVIZFPxK33czbbv"
imagePullPolicy: Never imagePullPolicy: Never
eventHubImageVersion: latest
account: account:
containerImage: "eventhub.account" containerImage: "eventhub.account"
api: api:

16
etc/k8s/scripts/build-images.ps1

@ -1,3 +1,5 @@
param ($version='latest')
$currentFolder = $PSScriptRoot $currentFolder = $PSScriptRoot
$slnFolder = Join-Path $currentFolder "../../../" $slnFolder = Join-Path $currentFolder "../../../"
$dbmigratorFolder = Join-Path $slnFolder "src/EventHub.DbMigrator" $dbmigratorFolder = Join-Path $slnFolder "src/EventHub.DbMigrator"
@ -13,49 +15,49 @@ $backgroundServicesFolder = Join-Path $slnFolder "src/EventHub.BackgroundService
Write-Host "*** BUILDING DB MIGRATOR ****************" -ForegroundColor Green Write-Host "*** BUILDING DB MIGRATOR ****************" -ForegroundColor Green
Set-Location $dbmigratorFolder Set-Location $dbmigratorFolder
dotnet publish -c Release dotnet publish -c Release
docker build -t eventhub.dbmigrator . docker build -t eventhub.dbmigrator:$version .
### WEB (WWW) ### WEB (WWW)
Write-Host "*** BUILDING WEB (WWW) ****************" -ForegroundColor Green Write-Host "*** BUILDING WEB (WWW) ****************" -ForegroundColor Green
Set-Location $webFolder Set-Location $webFolder
dotnet publish -c Release dotnet publish -c Release
docker build -t eventhub.www . docker build -t eventhub.www:$version .
### API ### API
Write-Host "*** BUILDING API ****************" -ForegroundColor Green Write-Host "*** BUILDING API ****************" -ForegroundColor Green
Set-Location $apiFolder Set-Location $apiFolder
dotnet publish -c Release dotnet publish -c Release
docker build -t eventhub.api . docker build -t eventhub.api:$version .
### ADMIN (BLAZOR) ### ADMIN (BLAZOR)
Write-Host "*** BUILDING ADMIN (BLAZOR) ****************" -ForegroundColor Green Write-Host "*** BUILDING ADMIN (BLAZOR) ****************" -ForegroundColor Green
Set-Location $adminFolder Set-Location $adminFolder
dotnet publish -c Release dotnet publish -c Release
docker build -t eventhub.admin . docker build -t eventhub.admin:$version .
### ADMIN API ### ADMIN API
Write-Host "*** BUILDING ADMIN API ****************" -ForegroundColor Green Write-Host "*** BUILDING ADMIN API ****************" -ForegroundColor Green
Set-Location $adminApiFolder Set-Location $adminApiFolder
dotnet publish -c Release dotnet publish -c Release
docker build -t eventhub.admin-api . docker build -t eventhub.admin-api:$version .
### IDENTITY SERVER (ACCOUNT) ### IDENTITY SERVER (ACCOUNT)
Write-Host "*** BUILDING IDENTITY SERVER (ACCOUNT) ****************" -ForegroundColor Green Write-Host "*** BUILDING IDENTITY SERVER (ACCOUNT) ****************" -ForegroundColor Green
Set-Location $identityServerFolder Set-Location $identityServerFolder
dotnet publish -c Release dotnet publish -c Release
docker build -t eventhub.account . docker build -t eventhub.account:$version .
### BACKGROUND SERVICES ### BACKGROUND SERVICES
Write-Host "*** BUILDING BACKGROUND SERVICES ****************" -ForegroundColor Green Write-Host "*** BUILDING BACKGROUND SERVICES ****************" -ForegroundColor Green
Set-Location $backgroundServicesFolder Set-Location $backgroundServicesFolder
dotnet publish -c Release dotnet publish -c Release
docker build -t eventhub.background-services . docker build -t eventhub.background-services:$version .
### ALL COMPLETED ### ALL COMPLETED

4
src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs

@ -112,7 +112,7 @@ namespace EventHub.Admin
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration) private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
{ {
context.Services.AddAbpSwaggerGenWithOAuth( context.Services.AddAbpSwaggerGenWithOAuth(
configuration[EventHubUrlOptions.GetAccountConfigKey()], EventHubUrlOptions.GetAccountConfigValue(configuration),
new Dictionary<string, string> new Dictionary<string, string>
{ {
{"EventHubAdmin", "EventHub Admin API"} {"EventHubAdmin", "EventHub Admin API"}
@ -151,7 +151,7 @@ namespace EventHub.Admin
{ {
builder builder
.WithOrigins( .WithOrigins(
configuration[EventHubUrlOptions.GetAdminConfigKey()] EventHubUrlOptions.GetAdminConfigValue(configuration)
) )
.WithAbpExposedHeaders() .WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains() .SetIsOriginAllowedToAllowWildcardSubdomains()

60
src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs

@ -1,49 +1,65 @@
namespace EventHub.Web using Microsoft.Extensions.Configuration;
namespace EventHub.Web
{ {
public class EventHubUrlOptions public class EventHubUrlOptions
{ {
private const string ConfigurationName = "AppUrls"; private const string ConfigurationName = "AppUrls";
private const string AccountDefaultValue = "https://localhost:44313";
private const string AdminDefaultValue = "https://localhost:44307";
private const string WwwDefaultValue = "https://localhost:44308";
private const string ApiDefaultValue = "https://localhost:44362";
private const string ApiInternalDefaultValue = ApiDefaultValue;
private const string AdminApiDefaultValue = "https://localhost:44305";
public string Account { get; set; } = "https://localhost:44313"; public string Account { get; set; } = AccountDefaultValue;
public string Www { get; set; } = "https://localhost:44308"; public string Www { get; set; } = WwwDefaultValue;
public string Api { get; set; } = "https://localhost:44362"; public string Api { get; set; } = ApiDefaultValue;
public string ApiInternal { get; set; } = "https://localhost:44362"; public string ApiInternal { get; set; } = ApiInternalDefaultValue;
public string Admin { get; set; } = "https://localhost:44307"; public string Admin { get; set; } = AdminDefaultValue;
public string AdminApi { get; set; } = "https://localhost:44305"; public string AdminApi { get; set; } = AdminApiDefaultValue;
public static string GetAccountConfigKey() public static string GetAccountConfigValue(IConfiguration configuration)
{ {
return GetConfigKey(nameof(Account)); return GetConfigValue(configuration, nameof(Account), AccountDefaultValue);
} }
public static string GetWwwConfigKey() public static string GetWwwConfigValue(IConfiguration configuration)
{ {
return GetConfigKey(nameof(Www)); return GetConfigValue(configuration, nameof(Www), WwwDefaultValue);
} }
public static string GetApiInternalConfigKey() public static string GetApiInternalConfigValue(IConfiguration configuration)
{ {
return GetConfigKey(nameof(ApiInternal)); return GetConfigValue(configuration, nameof(ApiInternal), ApiInternalDefaultValue);
} }
public static string GetApiConfigKey() public static string GetApiConfigValue(IConfiguration configuration)
{ {
return GetConfigKey(nameof(Api)); return GetConfigValue(configuration, nameof(Api), ApiDefaultValue);
} }
public static string GetAdminConfigKey() public static string GetAdminConfigValue(IConfiguration configuration)
{ {
return GetConfigKey(nameof(Admin)); return GetConfigValue(configuration, nameof(Admin), AdminDefaultValue);
} }
public static string GetAdminApiConfigKey() public static string GetAdminApiConfigValue(IConfiguration configuration)
{ {
return GetConfigKey(nameof(AdminApi)); return GetConfigValue(configuration, nameof(AdminApi), AdminApiDefaultValue);
} }
private static string GetConfigKey(string appName) private static string GetConfigKey(string appName)
{ {
return $"{ConfigurationName}:{appName}"; return $"{ConfigurationName}:{appName}";
} }
private static string GetConfigValue(
IConfiguration configuration,
string appName,
string defaultValue)
{
return configuration[GetConfigKey(appName)] ?? defaultValue;
}
} }
} }

4
src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs

@ -114,7 +114,7 @@ namespace EventHub
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration) private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
{ {
context.Services.AddAbpSwaggerGenWithOAuth( context.Services.AddAbpSwaggerGenWithOAuth(
configuration[EventHubUrlOptions.GetAccountConfigKey()], EventHubUrlOptions.GetAccountConfigValue(configuration),
new Dictionary<string, string> new Dictionary<string, string>
{ {
{"EventHub", "EventHub API"} {"EventHub", "EventHub API"}
@ -153,7 +153,7 @@ namespace EventHub
{ {
builder builder
.WithOrigins( .WithOrigins(
configuration[EventHubUrlOptions.GetWwwConfigKey()] EventHubUrlOptions.GetWwwConfigValue(configuration)
) )
.WithAbpExposedHeaders() .WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains() .SetIsOriginAllowedToAllowWildcardSubdomains()

21
src/EventHub.IdentityServer/EventHubIdentityServerModule.cs

@ -118,7 +118,7 @@ namespace EventHub
Configure<IdentityServerOptions>(options => Configure<IdentityServerOptions>(options =>
{ {
options.IssuerUri = configuration[EventHubUrlOptions.GetAccountConfigKey()]; options.IssuerUri = EventHubUrlOptions.GetAccountConfigValue(configuration);
}); });
if (hostingEnvironment.IsDevelopment()) if (hostingEnvironment.IsDevelopment())
@ -133,14 +133,13 @@ namespace EventHub
Configure<AppUrlOptions>(options => Configure<AppUrlOptions>(options =>
{ {
options.Applications["MVC"].RootUrl = configuration[EventHubUrlOptions.GetAccountConfigKey()]; options.Applications["MVC"].RootUrl = EventHubUrlOptions.GetAccountConfigValue(configuration);
options.RedirectAllowedUrls.AddRange( options.RedirectAllowedUrls.AddRange(
new[] new[]
{ {
configuration[EventHubUrlOptions.GetWwwConfigKey()], EventHubUrlOptions.GetWwwConfigValue(configuration),
configuration[EventHubUrlOptions.GetAdminConfigKey()], EventHubUrlOptions.GetApiConfigValue(configuration),
configuration[EventHubUrlOptions.GetApiConfigKey()], EventHubUrlOptions.GetAdminApiConfigValue(configuration)
configuration[EventHubUrlOptions.GetAdminApiConfigKey()]
}); });
}); });
@ -165,10 +164,10 @@ namespace EventHub
{ {
builder builder
.WithOrigins( .WithOrigins(
configuration[EventHubUrlOptions.GetWwwConfigKey()], EventHubUrlOptions.GetWwwConfigValue(configuration),
configuration[EventHubUrlOptions.GetApiConfigKey()], EventHubUrlOptions.GetApiConfigValue(configuration),
configuration[EventHubUrlOptions.GetAdminConfigKey()], EventHubUrlOptions.GetAdminConfigValue(configuration),
configuration[EventHubUrlOptions.GetAdminApiConfigKey()] EventHubUrlOptions.GetAdminApiConfigValue(configuration)
) )
.WithAbpExposedHeaders() .WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains() .SetIsOriginAllowedToAllowWildcardSubdomains()
@ -191,7 +190,7 @@ namespace EventHub
{ {
if (ctx.Request.Headers.ContainsKey("from-ingress")) if (ctx.Request.Headers.ContainsKey("from-ingress"))
{ {
ctx.SetIdentityServerOrigin(configuration[EventHubUrlOptions.GetAccountConfigKey()]); ctx.SetIdentityServerOrigin(EventHubUrlOptions.GetAccountConfigValue(configuration));
} }
await next(); await next();

4
src/EventHub.Web/EventHubWebModule.cs

@ -112,13 +112,13 @@ namespace EventHub.Web
{ {
Configure<AppUrlOptions>(options => Configure<AppUrlOptions>(options =>
{ {
options.Applications["MVC"].RootUrl = configuration[EventHubUrlOptions.GetWwwConfigKey()]; options.Applications["MVC"].RootUrl = EventHubUrlOptions.GetWwwConfigValue(configuration);
}); });
Configure<AbpRemoteServiceOptions>(options => Configure<AbpRemoteServiceOptions>(options =>
{ {
options.RemoteServices.Default = new RemoteServiceConfiguration( options.RemoteServices.Default = new RemoteServiceConfiguration(
configuration[EventHubUrlOptions.GetApiInternalConfigKey()] EventHubUrlOptions.GetApiInternalConfigValue(configuration)
.EnsureEndsWith('/') .EnsureEndsWith('/')
); );
}); });

2
src/EventHub.Web/Menus/EventHubMenuContributor.cs

@ -51,7 +51,7 @@ namespace EventHub.Web.Menus
if (currentUser.IsAuthenticated) if (currentUser.IsAuthenticated)
{ {
context.Menu.AddItem(new ApplicationMenuItem("Account.Manage", accountStringLocalizer["ManageYourProfile"], context.Menu.AddItem(new ApplicationMenuItem("Account.Manage", accountStringLocalizer["ManageYourProfile"],
$"{identityServerUrl.EnsureEndsWith('/')}Account/Manage?returnUrl={_configuration[EventHubUrlOptions.GetWwwConfigKey()]}", icon: "fa fa-cog", order: 1000, null, "_blank")); $"{identityServerUrl.EnsureEndsWith('/')}Account/Manage?returnUrl={EventHubUrlOptions.GetWwwConfigValue(_configuration)}", icon: "fa fa-cog", order: 1000, null, "_blank"));
context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "~/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000)); context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "~/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000));
} }

8
src/EventHub.Web/Pages/Index.cshtml

@ -40,7 +40,7 @@
<div class="col-lg-9 col-md-11 mx-auto"> <div class="col-lg-9 col-md-11 mx-auto">
<h1>.Net Foundation Week</h1> <h1>.Net Foundation Week</h1>
<p class="lead"> <p class="lead">
Lorem ipsum is placeholder text commonly used in the graphic. Lorem ipsum is placeholder text commonly used in the graphic!!
</p> </p>
<div> <div>
<a href="#" class="btn btn-primary">Join Now</a> <a href="#" class="btn btn-primary">Join Now</a>
@ -58,7 +58,7 @@
<div class="col-lg-9 col-md-11 mx-auto"> <div class="col-lg-9 col-md-11 mx-auto">
<h1>.Net Foundation Week</h1> <h1>.Net Foundation Week</h1>
<p class="lead"> <p class="lead">
Lorem ipsum is placeholder text commonly used in the graphic. Lorem ipsum is placeholder text commonly used in the graphic!
</p> </p>
<div> <div>
<a href="#" class="btn btn-primary">Join Now</a> <a href="#" class="btn btn-primary">Join Now</a>
@ -74,8 +74,8 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-11 mx-auto"> <div class="col-lg-9 col-md-11 mx-auto">
<h1>Let's Share Together</h1> <h1>Let's Share Together!</h1>
<p class="lead">Try something new, or do more of what you love.</p> <p class="lead">Try something new, or do more of what you love :)</p>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save