hey guys. trying to set the local configuration pa...
# ask-community
w
hey guys. trying to set the local configuration path, but is not being found. I’m doing as docs `export PREFECT__USER_CONFIG_PATH="path/to/config.toml"`I tried using both an absolute and a relative path and nothing. also tried settings the config (Slack webhook url) directly into the code, like this discussion and nothing, still getting the same
ValueError
where it can’t find Slack webhook URL
Any specifics for setting a quick & dirty secret for local testing? Any specifics for settings the USER_CONFIG_PATH when running the server locally in docker-compose? I made this work a while back, but I can’t figure out what I’m doing different this time. Thanks!
k
Hey @wiretrack, wondering if maybe your
"PREFECT__CLOUD__USE_LOCAL_SECRETS" = "false"
so it doesn’t pull the local secret? I guess you can test the config by logging
prefect.context.config
and seeing if other things in the file show up?
w
it seems that
use_local_secrets
is false indeed
This has to be set to
True
even if I have the
SLACK_WEBHOOK_URL
in a
.toml
file?
k
If it’s false, it will always look for Secrets in the Cloud only and won’t resolve the ones from that
.toml
w
can I set it inside the code?
prefect.context.secrets["USE_LOCAL_SECRETS"] = True
?
I’ll try a few variations with that now
k
No because the context is set the moment you import Prefect and is not really mutable like that. You need to set the env var with
os
before you
import prefect
to do it in code
w
Ok, thought it was mutable, got it. I tried
exporting
bot nothing. maybe I’ll have to restart the server
Also not working when settings with
os
even before importing Prefect, couldn’t make it work with
export
in the terminal right before registering the flow, I’m probably missing something, but don’t know exactly what
k
It would be like this
Copy code
import os
os.environ["PREFECT__CLOUD__USE_LOCAL_SECRETS"] = False
import prefect
Export in the terminal should work with
export PREFECT__CLOUD__USE_LOCAL_SECRETS=false
w
bool
doesnt work
Copy code
raise TypeError("str expected, not %s" % type(value).__name__)

TypeError: str expected, not bool
tried with “true” and ’True”
nothing as well
doesn’t change the printed configuration and can’t find the
local.toml
it works and just doing
flow.run()
but not when registering
k
Oh but when you register, it’s not part of the registration. It would be the settings on the agent.
w
so I have to restart the agent ?
k
Yes you would have to and edit the config.toml for the agent I believe.
w
so the Agent is the one responsible for the configuration management and stuff, right? It has nothing to do with the server and registration
k
For the flow run yes. Like if you wanted to set the logging to debug, it would be on the agent. (or env variable through the Flow Run Configuration)
w
Got it, so I couldn’t make the
os
approach work, even before importing prefect. But I could set the user config before starting the agent and it seems to get the correct configuration, i’ll do a few more tests
👍 1
Thanks!
k
Of course 👍