<@ULVA73B9P> Can I configure the PREFECT_WORKER_WE...
# ask-marvin
j
@Marvin Can I configure the PREFECT_WORKER_WEBSERVER_PORT in the prefect.yaml file or does it need to be in the environment of script the starts the worker?
m
thought for 103.2 seconds
Yes — you can configure it in your project config file, but not in
prefect.yaml
. For Prefect 3.x,
PREFECT_WORKER_WEBSERVER_PORT
is a runtime setting for the worker process. That means it’s read from Prefect’s settings system when the worker starts, not from deployment config in
prefect.yaml
. You have a few valid options: Environment variable
Copy code
bash
export PREFECT_WORKER_WEBSERVER_PORT=9090
prefect worker start --pool my-pool --with-healthcheck
Project
prefect.toml
Copy code
toml
[worker.webserver]
port = 9090
Also supported: -
.env
- active Prefect profile via
prefect config set
-
pyproject.toml
Important distinction: -
prefect.yaml
= deployment/project orchestration config -
PREFECT_WORKER_WEBSERVER_PORT
= worker process setting So if you're asking whether it must be in the shell script/environment that starts the worker: not necessarily. It can live in
prefect.toml
instead. But it does need to be available through Prefect settings at worker startup. Relevant docs: - Settings reference - Workers If you want, I can also show exactly how
prefect.yaml
and
prefect.toml
should coexist in the same project.