Everything works wonderfully now (and there is no longer a need for the workaround). After installing the licensed 1.1.0 version, I’m able to keep the configuration in the environment:
export PRODIGY_DB_NAME='[name]'
export PRODIGY_DB_HOST='[host]'
export PRODIGY_DB_USER='[user]'
export PRODIGY_DB_PASSWORD='[pass]'
and then inside a recipe can use this to initialize the database in exactly the way you described above:
import os
from prodigy.components.db import Database
from playhouse.postgres_ext import PostgresqlExtDatabase
psql_db = PostgresqlExtDatabase(
os.getenv('PRODIGY_DB_NAME'),
user=os.getenv('PRODIGY_DB_USER'),
password=os.getenv('PRODIGY_DB_PASSWORD'),
host=os.getenv('PRODIGY_DB_HOST'))
@recipe('custom')
def custom():
# ...
return {
# ...
'db': Database(psql_db)
}
Thank you very much for the advice, for the enhancement and for the inspiring work you do.