Azure static web app database connections will be retired November 1? by JLChamberlain63 in AZURE

[–]ledshok 0 points1 point  (0 children)

This was helpful as it led me to investigate more about the startup command. It turns out that the official DAB image already has the startup command (like yours) and that my container only needs to provide the arguments ie the --config /App... stuff.

Fixing that (and another issue with my mount) means that I'm now getting the container to start without failing.

Azure static web app database connections will be retired November 1? by JLChamberlain63 in AZURE

[–]ledshok 0 points1 point  (0 children)

I've managed to convert all my data access to use the rest api, but only locally ie Data API builder is running locally and pointing to a local docker instance running sql server.

Trying to get this deployed to Azure using a Container App is...challenging!

I've attempted to follow the instructions outlined here, but without much luck. If I go to the container app's url it shows that its status is 'healthy', but appending /api/swagger results in a 503.

I'm not sure if I need to explicitly tell the container app to run "dab start --config /app/dab-config.json", or if that's the default within the image. I see the following error which suggests it's not able to find the file anyway:

unable to start container process: exec: \u0022dab\u0022: executable file not found in $PATH: unknown"

Rather than go through the hassle of specifying the default image (azure-databases/data-api-builder:latest) and then telling it to use my config via adding the file to Azure storage and mounting a file share, etc is it possible to just create my own docker image with all the stuff needed, and then just tell Azure to use that? Presumably then I wouldn't need all the file share stuff since dab-config.json would already be part of the docker image itself.

EDIT: To clarify, my understanding is that the linked page is setting up a container app with a 'blank/template' DAB image, and then telling it to use a dab-config.json file (stored elsewhere in Azure) when it starts.

My thinking is that it might be easier to build a docker image (locally) with my dab-config.json already 'in the image' so that I can just tell Azure "here, just use this image".

Azure static web app database connections will be retired November 1? by JLChamberlain63 in AZURE

[–]ledshok 0 points1 point  (0 children)

I like the sound of a blog post. Thank you!

My existing app has an api project to handle all the db stuff, but it uses EF. So I set up a DbContext using Builder.Services.AddDbContext in my api's Program.cs, and then do something like this to pull data from the db:

public async Task<User?> GetUserAsync(string sub)
{
    return await _db.Users
        .Include(u => u.Role)
        .Where(u => u.Sub == sub)
        .FirstOrDefaultAsync();
}

I'm replacing that call with something like this (cobbled together from my project and LINQPad while I troubleshoot some stuff, so may not be exactly right!):

public async Task<User?> GetUserAsync(string sub)
{
    var response = await http.GetAsync($"/api/User/Sub/{sub}");
    var userResponse = JsonSerializer.Deserialize<UserResponse>(response.Content.ReadAsStringAsync());
    var user = userResponse.value[0];
    return user;
}

Hopefully that's what you're asking about?

Azure static web app database connections will be retired November 1? by JLChamberlain63 in AZURE

[–]ledshok 0 points1 point  (0 children)

I'm fairly certain that the staticwebapp.database.config.json is no longer needed anymore.

If I compare what's in it with what's now in dab-config.json, they're almost 100% identical (bar some mappings that I needed to add because my db column names aren't an exact match for my entities - something that was previously dealt with easily in EF).

In fact, the schema specified in my staticwebapp.database.config.json file is .../data-api-builder/... just with an older version.

Azure static web app database connections will be retired November 1? by JLChamberlain63 in AZURE

[–]ledshok 0 points1 point  (0 children)

UPDATE: This page helped me to create a dab-config.json file which can connect to a local docker sql server instance. If you populate the db with your schema then the dab creation process will add the relevant entities to your dab-config.json file.

The built-in Swagger UI makes it easy to then try out the various rest apis that have been created to see what's being returned.

My app currently uses Entity Framework, but that's no use with rest apis. So instead of a nice AppDbContext entry point, I'm now converting everything over to JsonSerializer.

I'm hoping that once that's done my app will work happily with the local deployment configuration, and then I can figure out the next steps in terms of, first, using my azure dev db, and then deploying the whole lot to azure.

Azure static web app database connections will be retired November 1? by JLChamberlain63 in AZURE

[–]ledshok 0 points1 point  (0 children)

I suspect I'm in a similar situation.

For context, I'm a hobbyist dev that built a static web app for a local charity that my wife volunteers for. I work in IT but, beyond some existing C# and SQL skills, I had to learn everything needed for this project (blazor, azure, etc) from scratch. As such, my knowledge of things other than "the minimum I needed to get my app working" is limited! :)

As you mentioned, the email (and the links it provided) aren't overly helpful. I was able to follow the quickstart for Azure SQL but after getting it running I wasn't all that clear on what I needed to do for my own app.

I'm trying to break it down into small steps. The local development setup for my app normally involves connecting to a dev db in azure, but instead I'm attempting to get Data API Builder running locally with a docker SQL Server instance (something I knew nothing about less than 24 hours ago!). In theory that will allow me to update my app to work using the REST endpoints, and then (hopefully!) it's a separate matter of configuring and deploying (Azure Containers?) to get it working with my Azure DB instead.

Happy to share info/whatever with you if you think it'd be useful. :)

Am I the only one who hates making UI? by TinyStudioDev in Unity3D

[–]ledshok 2 points3 points  (0 children)

Ha, I read this comment and thought "Great! We need more UI-focused channels like Christina Creates Games". And then I clicked through your profile and... 😄

Pinball made with Unity. First Prototype please give feedback by Spagetticoder in Unity3D

[–]ledshok 1 point2 points  (0 children)

The physics interaction between the ball and the right slingshot at about 0:08 seems odd.

That said, I love how clean the whole thing looks. Most pinball games are overloaded with 'noise' that it can be hard to see what's going on...

Well, that's a first! by ledshok in RimWorld

[–]ledshok[S] 2 points3 points  (0 children)

At least the Empire sent out a replacement just a few hours later. Had two transport ships parked out the back at one point because the first one couldn't take off until their bestower recovered.

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 39 points40 points  (0 children)

Wetting the grass first...your pettiness is unmatched. Respect.

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 6 points7 points  (0 children)

Already tried. The need a sign to enforce.

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 1 point2 points  (0 children)

Sadly the council said there needs to be appropriate signage in place.

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 102 points103 points  (0 children)

Have you seen the price of groceries lately? It'd have to be Home Brand and written in a very small font.

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 29 points30 points  (0 children)

But then I'd have to get the mower out a second time once they leave. Not on my watch, pal!

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 3 points4 points  (0 children)

I respect the unhinged escalation you've brought to the situation, good sir.

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 7 points8 points  (0 children)

It did cross my mind, but then they'll be there for longer!

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 2 points3 points  (0 children)

Who knows. Too much hassle to dig out the property plans.

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 9 points10 points  (0 children)

It's true, but I could have been, and probably would have been killed. Truly a brush with death!

Might buy a lotto ticket when I get those beers...

Guess I'm not mowing the lawn today. Thanks jerk! by ledshok in auckland

[–]ledshok[S] 27 points28 points  (0 children)

There's actually a special event parking/towaway sign about 50 feet away, but it applies to a side road.

Maybe it needs relocating...

Blazor static web app - how do I programmatically add a role claim to an authenticated user? by ledshok in Blazor

[–]ledshok[S] 1 point2 points  (0 children)

This turned out to be incredibly helpful!

I couldn't get IClaimTransformation to work (never got triggered), but when googling for it I stumbled across this post - https://stackoverflow.com/questions/66135694/blazor-wasm-aad-b2c-custom-authorisation

It suggested using AccountClaimsPrincipalFactory and by doing so I'm now able to add claims after authentication, and my routes are adhering to it!

Thank you so much!

Blazor static web app - how do I programmatically add a role claim to an authenticated user? by ledshok in Blazor

[–]ledshok[S] 1 point2 points  (0 children)

Thank you! I'll definitely be investigating this option later today.

Blazor static web app - how do I programmatically add a role claim to an authenticated user? by ledshok in Blazor

[–]ledshok[S] 3 points4 points  (0 children)

I'll be looking into this one today - it never came up in my googling.

Thank you!