https://pulumi.com logo
#dotnet
Title
# dotnet
l

little-kangaroo-50941

02/03/2020, 4:23 PM
could you please telle me why if I set a config with "pulumi config set sql:username" in one stack then when I try to retrieve it from Program.cs the error is "Missing Required configuration variable ProjectNamesqlusername" ?
m

microscopic-pilot-97530

02/03/2020, 5:37 PM
What does your code look like for accessing it?
l

little-kangaroo-50941

02/03/2020, 5:38 PM
var sqlusername = config.Require("sql:username"); var sqlpassword = config.RequireSecret("sql:password");
I don't know why it tries to concatenate also the project name to find the configuration...
m

microscopic-pilot-97530

02/03/2020, 5:41 PM
When you create the
Config
class, it uses the Project name as the namespace...
If you want to access a different namespace, you'll have to instantiate a new instance of
Config
...
l

little-kangaroo-50941

02/03/2020, 5:41 PM
no I don't pass the parameter, ad so it means by default I think
m

microscopic-pilot-97530

02/03/2020, 5:41 PM
Copy code
var sqlconfig = new Config("sql");
var sqlusername = sqlconfig.Require("username");
👍 1
l

little-kangaroo-50941

02/03/2020, 5:55 PM
ok so it means that if I have different namespaces in the same stack I need to instantiate different Config to be able to retrieve what i need, correct?
m

microscopic-pilot-97530

02/03/2020, 6:33 PM
Correct.