mirror of https://github.com/tp4a/teleport
fix: if path for sqlite database file not exists, web server not work.
parent
c68bbc6f3f
commit
aedea7d3c7
|
@ -28,6 +28,7 @@
|
|||
<file url="file://$PROJECT_DIR$/tp_core/core/ts_session.h" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/tp_core/core/ts_web_rpc.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/tp_core/core/ts_web_rpc.h" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/tp_core/protocol/rdp/rdp_proxy.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/tp_core/protocol/ssh/ssh_proxy.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/tp_core/protocol/ssh/ssh_proxy.h" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/tp_core/protocol/ssh/ssh_recorder.cpp" charset="GBK" />
|
||||
|
|
|
@ -34,7 +34,7 @@ core-server-rpc=http://127.0.0.1:52080/rpc
|
|||
; database in use, should be sqlite/mysql, default to sqlite.
|
||||
; type=sqlite
|
||||
|
||||
; sqlite-file=/var/lib/teleport/data/ts_db.db
|
||||
; sqlite-file=/usr/local/teleport/data/db/teleport.db
|
||||
|
||||
; mysql-host=127.0.0.1
|
||||
|
||||
|
|
|
@ -122,6 +122,11 @@ class TPDatabase:
|
|||
self._conn_pool = TPSqlitePool(db_file)
|
||||
|
||||
if not os.path.exists(db_file):
|
||||
|
||||
p = os.path.dirname(os.path.abspath(db_file))
|
||||
if not os.path.exists(p):
|
||||
os.makedirs(p)
|
||||
|
||||
log.w('database need create.\n')
|
||||
self.need_create = True
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue