|
@@ -4,10 +4,13 @@ from bottle import route, request, run, template, response, abort
|
|
import psycopg
|
|
import psycopg
|
|
from psycopg import Cursor, sql
|
|
from psycopg import Cursor, sql
|
|
import os
|
|
import os
|
|
-user = os.getenv('USER')
|
|
|
|
-password = os.getenv('PASSWORD')
|
|
|
|
-host = 'host=localhost'
|
|
|
|
-conn: Cursor = psycopg.connect(f"{host} dbname=pgdb user={user} {password}")
|
|
|
|
|
|
+host = f"host={os.getenv('HOST')}"
|
|
|
|
+db = f"dbname={os.getenv('DB', 'pgdb')}"
|
|
|
|
+user = f"user={os.getenv('USER', 'pgdb')}"
|
|
|
|
+password = f"password={os.getenv('PASSWORD','')}"
|
|
|
|
+if not password.split('=',1)[1]:
|
|
|
|
+ password = ''
|
|
|
|
+conn: Cursor = psycopg.connect(f"{host} {db} {user} {password}")
|
|
random_statement = """SELECT
|
|
random_statement = """SELECT
|
|
query_to_xml('SELECT category, translation, reference, txt
|
|
query_to_xml('SELECT category, translation, reference, txt
|
|
FROM pg_random_view_default_if_null
|
|
FROM pg_random_view_default_if_null
|
|
@@ -151,4 +154,4 @@ def specified():
|
|
response.content_type = 'application/xhtml+xml; charset=utf-8'
|
|
response.content_type = 'application/xhtml+xml; charset=utf-8'
|
|
return f"{heading}{xml[0]}{specified_schema}" + '\n'.join(xml[1:])
|
|
return f"{heading}{xml[0]}{specified_schema}" + '\n'.join(xml[1:])
|
|
|
|
|
|
-run(host='192.168.0.20', port=11888)
|
|
|
|
|
|
+run(host='0.0.0.0', port=11888)
|