Skip to content
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

Is it possible to provide AcceptedArns through config file? #57

Open
mehul9595 opened this issue Aug 5, 2021 · 2 comments · May be fixed by #61
Open

Is it possible to provide AcceptedArns through config file? #57

mehul9595 opened this issue Aug 5, 2021 · 2 comments · May be fixed by #61

Comments

@mehul9595
Copy link

Hello,

I'm trying to decouple accepted ARNs list from the program.cs to a config file, I have my config options defined below in appsettings.json,

"SecretsManagerConfigurationProviderOptions": {
   "acceptedSecretArns": [ "my-arn" ]
 }

Then from the code, I just call the manager like below

 try
            {
                var config = builder.Build();
                logger?.Information("reading secure settings from secrets manager");
                builder.AddSecretsManager(region: RegionEndpoint.USWest2);
                config = builder.Build();
            }
            catch (Exception ex)
            {
                logger?.Error(ex, "Unable to configure SecretsManager");
            }
            return builder;

Here, I'm not sure if the accepdSecretArns would be passed down to the library since I don't have the environment to test AWS secrets manager. Could you share your thoughts if this is correct approach?
Also, I would like to make RegionEndpoint as configurable from the appsettings option, any thoughts if I can achieve this?

Thanks

@Kralizek
Copy link
Owner

Hi @mehul9595

As of right now it is not possible to do as you ask. It should be tested how is it possible to use the configuration system to configure a configuration provider. Unfortunately, I never tried it before.

@devklick devklick linked a pull request Sep 17, 2021 that will close this issue
1 task
@gao87926
Copy link

gao87926 commented Aug 5, 2022

There is a walkaround, https://andrewlock.net/secure-secrets-storage-for-asp-net-core-with-aws-secrets-manager-part-2/

Basically, build you config first time, load appsettings, then addSecretManager can use the params from config, at the end, the builder have to build again

@Kralizek Kralizek linked a pull request Nov 8, 2022 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants