Implement setting working directory from ENV

This commit is contained in:
Kristóf Tóth 2018-01-24 16:26:01 +01:00
parent c7bc588397
commit eedf589ab7
3 changed files with 7 additions and 4 deletions

View File

@ -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"

View File

@ -6,6 +6,7 @@ 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)
TERMINADO_WD = os.getenv('TFW_TERMINADO_WD')
SUPERVISOR_HTTP_URI = 'http://localhost:{}'.format(SUPERVISOR_HTTP_PORT)

View File

@ -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)