Feature Request: Environmental Variables for Port Numbers

Currently, the port number for a Prodigy server can be changed through prodigy.json or the return config. It would be great if we could use an environmental variable to change the port, e.g. PRODIGY_PORT=8081 prodigy .... This makes more sense when we have multiple Prodigy servers running from the same prodigy.json.

Thanks

That’s a good idea, thanks! I think it’d make sense to first check for the environment variable, then the prodigy.json and if none are set, default to 8080. This would let you set a custom default port globally or per project, and overwrite it on the command line if necessary.

In the meantime, you can always add this functionality in the server function in Prodigy’s app.py:

port = os.getenv('PRODIGY_PORT', config.get('port', 8080))

For consistency, we should probably add the same for the host setting.

1 Like

Yes, that makes sense.

We currently have gnarly wrapper around plac to automatically inject a port number into the config :slight_smile:

1 Like

Implemented in v1.4.0 :tada: You can now set a PRODIGY_PORT and PRODIGY_HOST environment variable, which overwrites all other settings. I’ve also added a section to the README that lists all available environment variables for reference.

3 Likes