Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Configure and updated Runtime HOST settings using in CLI #2455

Merged
merged 11 commits into from
Nov 21, 2024

Conversation

sezal98
Copy link
Contributor

@sezal98 sezal98 commented Nov 10, 2024

Why make this change?

Resolved issue #2420
This change is made to enable dab users to update/change values of Rest and Cache runtime settings from CLI commands.
image

What is this change?

  1. Made changes in ConfigureOptions.cs to include the additional parameters for Host Runtime settings.
  2. Changes in ConfigureGenerator.cs to include the function to update the newly incoming values in the parameters of Host runtime settings
  3. Changes in Tests to add individual tests for all Host individual runtime settings like Host: Mode, Cors.Origins, Cors.AllowCredentials, Authentication.Provider, Authentication.Jwt.Audience, Authentication.Jwt.Issuer.

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

dab configure --runtime.host.mode {value} -c {Config-File-Name}
mode

dab configure --runtime.host.cors.origins {value} -c {Config-File-Name}
corsOrigins

dab configure --runtime.host.cors.allow-credentials {value} -c {Config-File-Name}
corsAllow

dab configure --runtime.host.authentication.provider {value} -c {Config-File-Name}
provider

dab configure --runtime.host.authentication.jwt.audience {value} -c {Config-File-Name}
audience

dab configure --runtime.host.authentication.jwt.issuer {value} -c {Config-File-Name}
issuer

@sezal98
Copy link
Contributor Author

sezal98 commented Nov 10, 2024

/azp run

@sezal98
Copy link
Contributor Author

sezal98 commented Nov 15, 2024

/azp run

Copy link
Contributor

@abhishekkumams abhishekkumams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just few nits.

@sezal98
Copy link
Contributor Author

sezal98 commented Nov 18, 2024

/azp run

@sezal98
Copy link
Contributor Author

sezal98 commented Nov 18, 2024

/azp run

@sezal98
Copy link
Contributor Author

sezal98 commented Nov 20, 2024

/azp run

Copy link
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@sezal98
Copy link
Contributor Author

sezal98 commented Nov 20, 2024

/azp run

@aaronburtle
Copy link
Contributor

/azp run

@abhishekkumams abhishekkumams merged commit 8f5cba5 into main Nov 21, 2024
7 checks passed
@abhishekkumams abhishekkumams deleted the dev/sezalchug/addConfigureHostRuntimeConfig branch November 21, 2024 12:18
updatedValue = options?.RuntimeHostMode;
if (updatedValue != null)
{
updatedHostOptions = updatedHostOptions! with { Mode = (HostMode)updatedValue };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is updatedHostOptions guaranteed to be not null here? If yes, why do we have the argument to the function defined to be nullable?

}
else
{
jwtOptions = updatedHostOptions.Authentication.Jwt with { Issuer = (string)updatedValue };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, Authentication.Jwt and can have audience and issuer values only when Authentication.Provider is Jwt. Can we validate before updating audience/issuer values that Provider is Jwt? If not, fail the update?

abhishekkumams pushed a commit that referenced this pull request Nov 28, 2024
## Why make this change?
Resolved issue #2420 
This change is made to enable dab users to update/change values of Rest
and Cache runtime settings from CLI commands.
<img width="665" alt="image"
src="https://github.com/user-attachments/assets/7be7f69a-2621-4cb3-8283-9087df04b2b2">

## What is this change?

1. Made changes in ConfigureOptions.cs to include the additional
parameters for Host Runtime settings.
2. Changes in ConfigureGenerator.cs to include the function to update
the newly incoming values in the parameters of Host runtime settings
3. Changes in Tests to add individual tests for all Host individual
runtime settings like Host: Mode, Cors.Origins, Cors.AllowCredentials,
Authentication.Provider, Authentication.Jwt.Audience,
Authentication.Jwt.Issuer.

## How was this tested?

- [x] Integration Tests
- [x] Unit Tests

## Sample Request(s)
`dab configure --runtime.host.mode {value} -c {Config-File-Name}`
<img width="662" alt="mode"
src="https://github.com/user-attachments/assets/81e4208e-1719-4948-ac59-b1d4625997f6">

`dab configure --runtime.host.cors.origins {value} -c
{Config-File-Name}`
<img width="662" alt="corsOrigins"
src="https://github.com/user-attachments/assets/7370cae5-56bb-49c6-abcb-6522819b1da5">

`dab configure --runtime.host.cors.allow-credentials {value} -c
{Config-File-Name}`
<img width="655" alt="corsAllow"
src="https://github.com/user-attachments/assets/bb31dc6a-31c0-4259-b2bb-e9c2535cdb3e">

`dab configure --runtime.host.authentication.provider {value} -c
{Config-File-Name}`
<img width="674" alt="provider"
src="https://github.com/user-attachments/assets/03efd7c3-2370-45b9-9626-5ece37f2e6d7">

`dab configure --runtime.host.authentication.jwt.audience {value} -c
{Config-File-Name}`
<img width="671" alt="audience"
src="https://github.com/user-attachments/assets/b4547bde-5520-47d0-84ab-c4f099ed3052">

`dab configure --runtime.host.authentication.jwt.issuer {value} -c
{Config-File-Name}`
<img width="669" alt="issuer"
src="https://github.com/user-attachments/assets/1c71fee2-8a4c-4472-b012-a775a979a8a1">

---------

Co-authored-by: sezalchug <sezalchug@microsoft.com>
Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] dab configure --runtime HOST in CLI [Enhancement] dab configure --runtime in CLI
6 participants