-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Config Parameters not loading #147
Comments
@mgeorgebrown89 PoshBot will only automatically supply those configuration-provided parameters to the command that was executed. It doesn't transfer to any other functions you call. In your primary command, define those parameters and then pass them to your other function. |
@devblackops Do the parameters need the mandatory option? |
I'm still having issues. I must be missing something. config.psd1
And the primary command:
ContentType "application/json" I pass the username and password to construct the URIs and session headers, but I get this error in slack:
When I hard-code the values into those parameters, everything works as expected, so for some reason it's not pulling the values from the config file.... Edit: Something else I just thought of for context: I'm using Export-ModuleMember to choose which functions are actually exported, rather than determining this in the config file. I saw @RamblingCookieMonster do this on his blog and for some reason I don't remember I went this way. Perhaps this is a problem? Edit2: Even just copying and pasting the Get-foo example and trying to print the parameter from the config as ouput gives me the same error as above. |
@mgeorgebrown89 I'll take your config and command and see if I can repro. Is your plugin named Your plugin configuration has the following: PluginConfiguration = @{
vectoria = @{
nfUsername = "xxxxxxxx"
nfPassword = "xxxxxxxxx"
}
} Is your plugin that contains the |
So I think I'm a moron... Anytime I edited the config file, I was updating the plugin and testing and I kept getting the same results, but obviously that would be the case because that doesn't update the configuration the bot is running off of. Ugh. So I would make a change, and sometimes I would take effect, and other times not, so I would get varying results from doing the same thing. Long story short, I fixed it. @devblackops |
Glad to hear it @mgeorgebrown89 👍 |
Parameters aren't being pulled from config. Maybe I've set it up incorrectly.
In my plugin:
Those two variables are then used to make API calls, but it's not working. This is my config file:
When i hard code the values above, it works fine. I'm not sure what's going on here. I've tried a few different things like making the parameter mandatory, but its not working.
Context: This function is called by another function. It creates the header for use with other API calls. My intention is to call it from another function, so this function itself isn't exported to the plugin. Could that be the issue? ###
The text was updated successfully, but these errors were encountered: