12
12
using System . Diagnostics . CodeAnalysis ;
13
13
using System . Globalization ;
14
14
using System . Net . Sockets ;
15
+ using System . Threading . Tasks ;
15
16
using static CommunityToolkit . Aspire . Hosting . Dapr . CommandLineArgs ;
16
17
17
18
namespace CommunityToolkit . Aspire . Hosting . Dapr ;
@@ -491,7 +492,7 @@ private async Task<string> GetComponentAsync(DaprComponentResource component, Fu
491
492
{
492
493
// We should try to read content from a known location (such as aspire root directory)
493
494
logger . LogInformation ( "Unvalidated configuration {specType} for component '{ComponentName}'." , component . Type , component . Name ) ;
494
- return await contentWriter ( GetDaprComponent ( component , component . Type ) ) . ConfigureAwait ( false ) ;
495
+ return await contentWriter ( await GetDaprComponent ( component , component . Type ) ) . ConfigureAwait ( false ) ;
495
496
}
496
497
private async Task < string > GetBuildingBlockComponentAsync ( DaprComponentResource component , Func < string , Task < string > > contentWriter , string defaultProvider , CancellationToken cancellationToken )
497
498
{
@@ -544,19 +545,19 @@ private static async Task<string> GetDefaultContent(DaprComponentResource compon
544
545
string defaultContent = await File . ReadAllTextAsync ( defaultContentPath , cancellationToken ) . ConfigureAwait ( false ) ;
545
546
string yaml = defaultContent . Replace ( $ "name: { component . Type } ", $ "name: { component . Name } ") ;
546
547
DaprComponentSchema content = DaprComponentSchema . FromYaml ( yaml ) ;
547
- ConfigureDaprComponent ( component , content ) ;
548
+ await ConfigureDaprComponent ( component , content ) ;
548
549
return content . ToString ( ) ;
549
550
}
550
551
551
552
552
- private static string GetDaprComponent ( DaprComponentResource component , string type )
553
+ private static async Task < string > GetDaprComponent ( DaprComponentResource component , string type )
553
554
{
554
555
var content = new DaprComponentSchema ( component . Name , type ) ;
555
- ConfigureDaprComponent ( component , content ) ;
556
+ await ConfigureDaprComponent ( component , content ) ;
556
557
return content . ToString ( ) ;
557
558
}
558
559
559
- private static void ConfigureDaprComponent ( DaprComponentResource component , DaprComponentSchema content )
560
+ private static async Task ConfigureDaprComponent ( DaprComponentResource component , DaprComponentSchema content )
560
561
{
561
562
if ( component . TryGetAnnotationsOfType < DaprComponentSecretAnnotation > ( out var secrets ) && secrets . Any ( ) )
562
563
{
@@ -566,7 +567,7 @@ private static void ConfigureDaprComponent(DaprComponentResource component, Dapr
566
567
{
567
568
foreach ( var annotation in annotations )
568
569
{
569
- annotation . Configure ( content ) ;
570
+ await annotation . Configure ( content ) ;
570
571
}
571
572
}
572
573
}
0 commit comments