From eedf589ab7e200b9c3437d952935b0454d2fd102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 24 Jan 2018 16:26:01 +0100 Subject: [PATCH] Implement setting working directory from ENV --- Dockerfile | 1 + lib/config/envvars.py | 5 +++-- src/event_handlers/terminado_server/server.py | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 99c8127..20fb9ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,6 +54,7 @@ ENV TFW_APP_DIR="/srv/app" ENV TFW_FRONTEND_DIR="/srv/frontend" ENV TFW_LOGIN_APP_DIR="/tmp/source_code_server" ENV TFW_TERMINADO_DIR="/tmp/terminado_server" +ENV TFW_TERMINADO_WD="/home/${AVATAO_USER}" ENV TFW_LIB_DIR="/usr/local/lib/" ENV TFW_SUPERVISORD_CONF="/etc/supervisor/supervisord.conf" diff --git a/lib/config/envvars.py b/lib/config/envvars.py index 38a105a..297c4bd 100644 --- a/lib/config/envvars.py +++ b/lib/config/envvars.py @@ -4,8 +4,9 @@ PUBLISHER_PORT = os.getenv('PUBLISHER_PORT', 7654) RECEIVER_PORT = os.getenv('RECEIVER_PORT', 8765) WEB_PORT = os.getenv('TFW_WEB_PORT', 4242) SUPERVISOR_HTTP_PORT = os.getenv('TFW_SUPERVISOR_PORT', 9001) -LOGIN_APP_PORT= os.getenv('TFW_LOGIN_APP_PORT', 6666) -TERMINADO_PORT= os.getenv('TFW_TERMINADO_PORT', 9999) +LOGIN_APP_PORT = os.getenv('TFW_LOGIN_APP_PORT', 6666) +TERMINADO_PORT = os.getenv('TFW_TERMINADO_PORT', 9999) +TERMINADO_WD = os.getenv('TFW_TERMINADO_WD') SUPERVISOR_HTTP_URI = 'http://localhost:{}'.format(SUPERVISOR_HTTP_PORT) diff --git a/src/event_handlers/terminado_server/server.py b/src/event_handlers/terminado_server/server.py index 28b49b1..6cdae84 100644 --- a/src/event_handlers/terminado_server/server.py +++ b/src/event_handlers/terminado_server/server.py @@ -3,7 +3,7 @@ from tornado.ioloop import IOLoop from tornado.web import Application from terminado import TermSocket, SingleTermManager -from config import TERMINADO_PORT +from config import TERMINADO_PORT, TERMINADO_WD class CORSTermSocket(TermSocket): @@ -15,7 +15,8 @@ if __name__ == '__main__': [( r'/terminal', CORSTermSocket, - {'term_manager': SingleTermManager(shell_command=['bash'])} + {'term_manager': SingleTermManager(shell_command=['bash'], + term_settings={'cwd': TERMINADO_WD})} )] ) application.listen(TERMINADO_PORT)