I understand that we can change certain settings in the appsetings.json
. This applies the default settings to the host and tenant level.
"Settings": {
"Abp.Identity.User.IsUserNameUpdateEnabled": false,
"Abp.Identity.User.IsEmailUpdateEnabled": false,
"Abp.Account.IsSelfRegistrationEnabled": false
},
When testing locally using dotnet run
or using a docker container, these settings work fine. I can see that the values in the settings page are updated correctly
However they are not applied when we deploy this to ECS (ABP backend is running in an ECS Task)
I've even tried to update using environment variables. But it doesn't work either
Could you outline any possible reason for this? I've checked that those settings are not overwritten in the DB
7 Answer(s)
-
0
Hi,
you can override
SettingProvider
andSettingManagement
to log the setting value from where and check it log.[Dependency(ReplaceServices = true)] [ExposeServices(typeof(ISettingProvider))] public class MySettingProvider : SettingProvider { private readonly ILogger<MySettingManagement> _logger; public MySettingProvider([NotNull] ISettingDefinitionManager settingDefinitionManager, [NotNull] ISettingEncryptionService settingEncryptionService, [NotNull] ISettingValueProviderManager settingValueProviderManager, ILogger<MySettingManagement> logger) : base(settingDefinitionManager, settingEncryptionService, settingValueProviderManager) { _logger = logger; } protected async override Task<string> GetOrNullValueFromProvidersAsync(IEnumerable<ISettingValueProvider> providers, SettingDefinition setting) { foreach (var provider in providers) { var value = await provider.GetOrNullAsync(setting); _logger.LogInformation($"Get value from SettingProvider: {provider.Name}, Value: {value}"); if (value != null) { return value; } } return null; } } [Dependency(ReplaceServices = true)] [ExposeServices(typeof(ISettingManager))] public class MySettingManagement : SettingManager { private readonly ILogger<MySettingManagement> _logger; public MySettingManagement(IOptions<SettingManagementOptions> options, IServiceProvider serviceProvider, ISettingDefinitionManager settingDefinitionManager, ISettingEncryptionService settingEncryptionService, ISettingManagementStore settingManagementStore, ILogger<MySettingManagement> logger) : base(options, serviceProvider, settingDefinitionManager, settingEncryptionService, settingManagementStore) { _logger = logger; } protected async override Task<string> GetOrNullInternalAsync(string name, string providerName, string providerKey, bool fallback = true) { var setting = await SettingDefinitionManager.GetAsync(name); var providers = Enumerable .Reverse(Providers); if (providerName != null) { providers = providers.SkipWhile(c => c.Name != providerName); } if (!fallback || !setting.IsInherited) { providers = providers.TakeWhile(c => c.Name == providerName); } string value = null; foreach (var provider in providers) { value = await provider.GetOrNullAsync( setting, provider.Name == providerName ? providerKey : null ); _logger.LogInformation($"Get value from SettingProvider: {provider.Name}, Value: {value}"); if (value != null) { break; } } if (setting.IsEncrypted) { value = SettingEncryptionService.Decrypt(setting, value); } return value; } }
-
0
Will post the results here soon
-
0
okay
-
0
Hi managed to get it resolved. We realised that as part of our CI/CD pipeline, we were running
dotnet publish "MyApp.sln"
During the creation of artifacts, the last project to be published is NOT the
HttpApi.Host
project. Hence,appsettings.json
forHttpApi.Host
was overwritten by another projectappsettings.json
.The resolution was to only publish the needed artifact i.e.
dotnet publish "MyApp.HttpApi.Host/MyApp.HttpApi.Host.csproj"
Note: the commands are not exactly as used in our project but conveys the idea (we also added flags such as -c Release etc)
-
0
Also, do you happen to know the change you made in this ticket: https://abp.io/qa/questions/7297/3a130461-8b69-1a8a-743f-133fccbac906
We are having the exact same issue whereby the issuer still defaults to the main domain of the backend (api.mydomain.com) instead of the subdomain (tenant.api.mydomain.com).
-
0
Hi,
It's a new question.
I think we close this. : )
-
0
thanks,
fyi managed to solve new question issue by removing
serverBuilder.SetIssuer(new Uri(configuration["AuthServer:Authority"]!));