-
-
Notifications
You must be signed in to change notification settings - Fork 506
Migrates to Aspire Azure Storage Emulator instead of MinIO for local dev #2105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ public class QueueOptions | |
| { | ||
| public string? ConnectionString { get; internal set; } | ||
| public string? Provider { get; internal set; } | ||
| public Dictionary<string, string> Data { get; internal set; } = null!; | ||
| public Dictionary<string, string> Data { get; internal set; } = new(StringComparer.OrdinalIgnoreCase); | ||
|
|
||
| public string Scope { get; internal set; } = null!; | ||
| public string ScopePrefix { get; internal set; } = null!; | ||
|
|
@@ -18,36 +18,45 @@ public class QueueOptions | |
|
|
||
| public static QueueOptions ReadFromConfiguration(IConfiguration config, AppOptions appOptions) | ||
| { | ||
| var options = new QueueOptions { Scope = appOptions.AppScope }; | ||
| options.ScopePrefix = !String.IsNullOrEmpty(options.Scope) ? $"{options.Scope}-" : String.Empty; | ||
| var options = new QueueOptions | ||
| { | ||
| Scope = appOptions.AppScope, | ||
| ScopePrefix = !String.IsNullOrEmpty(appOptions.AppScope) ? $"{appOptions.AppScope}-" : String.Empty, | ||
| MetricsPollingInterval = appOptions.AppMode == AppMode.Development ? TimeSpan.FromSeconds(15) : TimeSpan.FromSeconds(5) | ||
| }; | ||
|
|
||
| string? cs = config.GetConnectionString("Queue"); | ||
| if (cs != null) | ||
| if (!String.IsNullOrWhiteSpace(cs)) | ||
| { | ||
| options.Data = cs.ParseConnectionString(); | ||
| options.Provider = options.Data.GetString(nameof(options.Provider)); | ||
| } | ||
| else | ||
| { | ||
| var redisConnectionString = config.GetConnectionString("Redis"); | ||
| string? azureStorageConnectionString = config.GetConnectionString("AzureQueues"); | ||
| if (!String.IsNullOrEmpty(azureStorageConnectionString)) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was forced to simplify somethings here if you have an AzureQueues connection string we just use the connection string. Noramlized Redis that way too. We need towards making our configuration easier to understand, this was required at least for queueus because if it falls through and looks up the provider connection string it will get replaced with the storage connection string (and not the queue one). |
||
| { | ||
| options.Provider = "azurestorage"; | ||
| options.ConnectionString = azureStorageConnectionString; | ||
| options.Data = azureStorageConnectionString.ParseConnectionString(); | ||
| return options; | ||
| } | ||
|
|
||
| string? redisConnectionString = config.GetConnectionString("Redis"); | ||
| if (!String.IsNullOrEmpty(redisConnectionString)) | ||
| { | ||
| options.Provider = "redis"; | ||
| options.ConnectionString = redisConnectionString; | ||
| options.Data = redisConnectionString.ParseConnectionString(); | ||
| return options; | ||
| } | ||
| } | ||
|
|
||
| string? providerConnectionString = !String.IsNullOrEmpty(options.Provider) ? config.GetConnectionString(options.Provider) : null; | ||
| if (!String.IsNullOrEmpty(providerConnectionString)) | ||
| { | ||
| var providerOptions = providerConnectionString.ParseConnectionString(defaultKey: "server"); | ||
| options.Data ??= new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); | ||
| options.Data.AddRange(providerOptions); | ||
| } | ||
| options.Data.AddRange(providerConnectionString.ParseConnectionString()); | ||
|
niemyjski marked this conversation as resolved.
|
||
|
|
||
| options.ConnectionString = options.Data.BuildConnectionString(new HashSet<string> { nameof(options.Provider) }); | ||
|
|
||
| options.MetricsPollingInterval = appOptions.AppMode == AppMode.Development ? TimeSpan.FromSeconds(15) : TimeSpan.FromSeconds(5); | ||
|
|
||
| return options; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,15 @@ namespace Exceptionless.Core.Extensions; | |
|
|
||
| public static class DictionaryExtensions | ||
| { | ||
| public static void AddRange<TKey, TValue>(this IDictionary<TKey, TValue>? dictionary, IDictionary<TKey, TValue>? range) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We were using the Foundatio.Repositories AddRange (we need to internalize that..) And that was throwing duplicate key because it was calling add on KVP. This is last in wins. |
||
| { | ||
| if (dictionary is null || range is null) | ||
| return; | ||
|
|
||
| foreach (var r in range) | ||
| dictionary[r.Key] = r.Value; | ||
| } | ||
|
|
||
| public static void Trim(this HashSet<string?> items, Predicate<string?> itemsToRemove, Predicate<string?> itemsToAlwaysInclude, int maxLength) | ||
| { | ||
| items.RemoveWhere(itemsToRemove); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't love that this matches the provider name for our configuration connection strings but it defines what it is.