let pyko skeletons setup 'appdb' if available.

If a worker can pickup PYKO_CONNINFO from the environment it will register a
new pgsql connection called 'appdb' tied to the given connection string.
This commit is contained in:
Joris Vink 2018-04-10 18:26:22 +02:00
parent a35dfc6d06
commit bb210db3df
1 changed files with 6 additions and 1 deletions

View File

@ -345,7 +345,12 @@ static const char *pyko_init_data =
"if port is None:\n"
"\tport = '8888'\n"
"\n"
"kore.listen(ip, port, '')\n";
"kore.listen(ip, port, '')\n"
"\n"
"def kore_worker_configure():\n"
"\tconninfo = os.getenv('PYKO_CONNINFO')\n"
"\tif conninfo is not None:\n"
"\t\tkore.register_database('appdb', conninfo)\n";
static const char *pyko_handlers_data =
"import kore\n"