Greenthy
Greenthy
CC#
Created by Greenthy on 12/22/2024 in #help
Aspire YARP custom domain instead of localhost
not really following there, but for now I'm just going to stick to localhost till I find the courage to deep dive into this again
14 replies
CC#
Created by Greenthy on 12/22/2024 in #help
Aspire YARP custom domain instead of localhost
Having a bit of silly trouble hosting the cert though. Ive tried setting the kestrel endpoints variable, but it needs an url. I don't know which url to pass as it's dynamically created by aspire
14 replies
CC#
Created by Greenthy on 12/22/2024 in #help
Aspire YARP custom domain instead of localhost
well aside from not providing the certificate ofc
14 replies
CC#
Created by Greenthy on 12/22/2024 in #help
Aspire YARP custom domain instead of localhost
https://github.com/kvloover/CustomDomainAspire Sadly this slimmed down version appears to be working, I'll try investigating if I properly cleaned up the IIS part i guess
14 replies
CC#
Created by Greenthy on 12/22/2024 in #help
Aspire YARP custom domain instead of localhost
yarp program.cs:
c#
builder.Services
.AddServiceDiscovery()
.AddReverseProxy()
.LoadFromMemory(...)
.AddServiceDiscoveryDestinationResolver();
c#
builder.Services
.AddServiceDiscovery()
.AddReverseProxy()
.LoadFromMemory(...)
.AddServiceDiscoveryDestinationResolver();
aspire:
c#
var gateway = builder.AddProject<Projects.ApiGateway>("gateway")
.WithHttpsEndpoint(port: 443)
.WithReverseProxyEndpoint("app-dev", "https://app-dev.myapp.com")
.WithReference(api1)
.WithReference(api2)
.WithReference(apiclient);
c#
var gateway = builder.AddProject<Projects.ApiGateway>("gateway")
.WithHttpsEndpoint(port: 443)
.WithReverseProxyEndpoint("app-dev", "https://app-dev.myapp.com")
.WithReference(api1)
.WithReference(api2)
.WithReference(apiclient);
api1 and api2 are net8 minimal api's, apiclient an angular spa
14 replies
CC#
Created by Greenthy on 12/22/2024 in #help
Aspire YARP custom domain instead of localhost
YARP config is basicly: Routeconfig:
C#
new RouteConfig()
{
RouteId = RouteName(config),
ClusterId = ClusterName(config),
Match = new RouteMatch()
{
Path = config.Path.TrimEnd('/') + "/{**catchall}"
},
Transforms = new List<Dictionary<string, string>>()
{
new() { { YarpTransforms.PathRemovePrefix, config.Path.TrimEnd('/') } }
}
};
C#
new RouteConfig()
{
RouteId = RouteName(config),
ClusterId = ClusterName(config),
Match = new RouteMatch()
{
Path = config.Path.TrimEnd('/') + "/{**catchall}"
},
Transforms = new List<Dictionary<string, string>>()
{
new() { { YarpTransforms.PathRemovePrefix, config.Path.TrimEnd('/') } }
}
};
Clusterconfig:
C#
return new ClusterConfig()
{
ClusterId = ClusterName(config),
Destinations = new Dictionary<string, DestinationConfig>()
{
{
DestinationName(config),
new DestinationConfig()
{
Address = config.BackendUrl,
}
}
}
};
C#
return new ClusterConfig()
{
ClusterId = ClusterName(config),
Destinations = new Dictionary<string, DestinationConfig>()
{
{
DestinationName(config),
new DestinationConfig()
{
Address = config.BackendUrl,
}
}
}
};
with the backendUrl http://api1 etc... .
14 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
you'll probably be fine with an easy loop and exiting then
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
I guess you ment me saying it might be messier> I think it's messier cuz it's alot of code, which might end up bloated because all the logic is in the single place. You might want to pass along the results, start adding some conversions / type checking etc. If you use monads it becomes a bit more of a conceptual work than hard coded work. Which will probably result in less code and imo thus less 'messy'. I imagine especially conversions between the actual data results will get messy in your example. But if you never need any other logic in there, just looping over the steps can be the easiest as mentioned.
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
it's less fun though, and probably a lot messier code. But probably easier concept to grasp
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
and just chain them up manually
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
which return a tuple or some object you can check if it succeeded
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
you could ofcourse also go an easier way, making it an array of func's
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
and continue on an empty one is just another empty one without invoking the step
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
it's basicly a class for which the continue returns either a new class containing the result or is empty
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
but once you go down the monad path, be prepared for some headwinds 😄
40 replies
CC#
Created by FroH.LVT on 9/29/2022 in #help
Execute multiple steps with error checking [Answered]
Depending on your use case, your own implementation is also pretty easy to make
40 replies
CC#
Created by M B V R K on 9/22/2022 in #help
EF Core Global Query Filter Exception
the result is another expression, you can use it similar or then use it as the input to convert it to a lambda function
38 replies
CC#
Created by M B V R K on 9/22/2022 in #help
EF Core Global Query Filter Exception
Expression.OrElse( Expression.AndAlso(null check, value check), Expression.AndAllso( null check 2, valuecheck 2))
38 replies
CC#
Created by M B V R K on 9/22/2022 in #help
EF Core Global Query Filter Exception
you can keep combining the binary expressions
38 replies
CC#
Created by M B V R K on 9/22/2022 in #help
EF Core Global Query Filter Exception
combine the expression you have using an andalso with a similar statement checking the value
38 replies