1. 设定服务端版本为2.2.8.1,准备发布;2. 为docker发布调整默认数据目录路径(安装目录下的data目录),包括配置文件、日志文件、录像文件、数据库文件等;

pull/32/head
Apex Liu 2017-05-24 17:28:28 +08:00
parent 7e80ab6ed3
commit 9ab930bd55
26 changed files with 584 additions and 575 deletions

5
.gitignore vendored
View File

@ -57,10 +57,9 @@ __pycache__
/server/share/etc/core.ini /server/share/etc/core.ini
/server/share/etc/web.ini /server/share/etc/web.ini
/server/share/data /server/share/db
/server/share/log /server/share/log
/server/www/teleport/.idea/vcs.xml /server/share/replay
/server/www/packages/packages-windows/x64
# for generated files. # for generated files.

View File

@ -1,3 +1,3 @@
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
VER_TELEPORT_SERVER = "2.2.7.3" VER_TELEPORT_SERVER = "2.2.8.1"
VER_TELEPORT_ASSIST = "2.2.5.1" VER_TELEPORT_ASSIST = "2.2.6.1"

Binary file not shown.

View File

@ -1,6 +1,6 @@
#ifndef __TS_ASSIST_VER_H__ #ifndef __TS_ASSIST_VER_H__
#define __TS_ASSIST_VER_H__ #define __TS_ASSIST_VER_H__
#define TP_ASSIST_VER L"2.2.5.1" #define TP_ASSIST_VER L"2.2.6.1"
#endif // __TS_ASSIST_VER_H__ #endif // __TS_ASSIST_VER_H__

View File

@ -104,7 +104,7 @@ ExThreadManager::~ExThreadManager()
{ {
if (m_threads.size() > 0) if (m_threads.size() > 0)
{ {
EXLOGE("[ERROR] when destroy thread manager, there are %d thread not exit.\n", m_threads.size()); EXLOGE("when destroy thread manager, there are %d thread not exit.\n", m_threads.size());
stop_all(); stop_all();
} }
} }
@ -130,7 +130,7 @@ void ExThreadManager::add(ExThreadBase* tb)
{ {
if ((*it) == tb) if ((*it) == tb)
{ {
EXLOGE("[ERROR] when add thread to manager, it already exist.\n"); EXLOGE("when add thread to manager, it already exist.\n");
return; return;
} }
} }
@ -152,7 +152,7 @@ void ExThreadManager::remove(ExThreadBase* tb)
return; return;
} }
} }
EXLOGE("[ERROR] when remove thread from manager, it not exist.\n"); EXLOGE("when remove thread from manager, it not exist.\n");
} }
//========================================================= //=========================================================

Binary file not shown.

View File

@ -376,9 +376,9 @@ class InstallerWin(InstallerBase):
return return
def _fix_path(self): def _fix_path(self):
self._config_path = os.path.join(self._install_path, 'etc')
self._data_path = os.path.join(self._install_path, 'data') self._data_path = os.path.join(self._install_path, 'data')
self._log_path = os.path.join(self._install_path, 'log') self._config_path = os.path.join(self._data_path, 'etc')
self._log_path = os.path.join(self._data_path, 'log')
def _copy_files(self): def _copy_files(self):
utils.copy_ex(os.path.join(env.src_path, 'bin'), os.path.join(self._install_path, 'bin')) utils.copy_ex(os.path.join(env.src_path, 'bin'), os.path.join(self._install_path, 'bin'))
@ -392,8 +392,8 @@ class InstallerWin(InstallerBase):
utils.remove(os.path.join(self._install_path, 'www')) utils.remove(os.path.join(self._install_path, 'www'))
if del_settings: if del_settings:
utils.remove(self._data_path) utils.remove(self._data_path)
utils.remove(self._config_path) # utils.remove(self._config_path)
utils.remove(self._log_path) # utils.remove(self._log_path)
# only remove the installation path when it empty. # only remove the installation path when it empty.
try: try:
@ -516,9 +516,12 @@ class InstallerLinux(InstallerBase):
return return
def _fix_path(self): def _fix_path(self):
self._config_path = '/etc/teleport' # self._config_path = '/etc/teleport'
self._data_path = os.path.join('/var/lib/teleport') # self._data_path = os.path.join('/var/lib/teleport')
self._log_path = os.path.join('/var/log/teleport') # self._log_path = os.path.join('/var/log/teleport')
self._data_path = os.path.join(self._install_path, 'data')
self._config_path = os.path.join(self._data_path, 'etc')
self._log_path = os.path.join(self._data_path, 'log')
def _copy_files(self): def _copy_files(self):
utils.copy_ex(os.path.join(env.src_path, 'bin'), os.path.join(self._install_path, 'bin')) utils.copy_ex(os.path.join(env.src_path, 'bin'), os.path.join(self._install_path, 'bin'))
@ -543,8 +546,8 @@ class InstallerLinux(InstallerBase):
if del_settings: if del_settings:
utils.remove(self._data_path) utils.remove(self._data_path)
utils.remove(self._config_path) # utils.remove(self._config_path)
utils.remove(self._log_path) # utils.remove(self._log_path)
def _install_service(self): def _install_service(self):
daemon_files = [ daemon_files = [

View File

@ -38,7 +38,7 @@ void TppRecBase::end()
#ifdef EX_DEBUG #ifdef EX_DEBUG
if (m_cache.size() > 0) if (m_cache.size() > 0)
{ {
EXLOGE("[ssh] not all record data saved.\n"); EXLOGE("not all record data saved.\n");
} }
#endif #endif
} }

Binary file not shown.

View File

@ -82,7 +82,7 @@ bool ts_db_field_encrypt(const ex_bin& bin_dec, ex_astr& str_enc)
mbedtls_aes_init(&ctx); mbedtls_aes_init(&ctx);
if (0 != mbedtls_aes_setkey_enc(&ctx, g_db_field_aes_key, 256)) if (0 != mbedtls_aes_setkey_enc(&ctx, g_db_field_aes_key, 256))
{ {
EXLOGE("invalid AES key.\n"); EXLOGE("[core] invalid AES key.\n");
return false; return false;
} }
@ -91,7 +91,7 @@ bool ts_db_field_encrypt(const ex_bin& bin_dec, ex_astr& str_enc)
memset(iv, 0, 16); memset(iv, 0, 16);
if (0 != mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, enc_size, iv, &bin_be_enc[0], &bin_enc[0])) if (0 != mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, enc_size, iv, &bin_be_enc[0], &bin_enc[0]))
{ {
EXLOGE("AES-CBC encrypt failed.\n"); EXLOGE("[core] AES-CBC encrypt failed.\n");
mbedtls_aes_free(&ctx); mbedtls_aes_free(&ctx);
return false; return false;
} }
@ -104,7 +104,7 @@ bool ts_db_field_encrypt(const ex_bin& bin_dec, ex_astr& str_enc)
size_t olen = 0; size_t olen = 0;
if (0 != mbedtls_base64_encode(&enc_b64[0], enc_size * 2, &olen, &bin_enc[0], enc_size)) if (0 != mbedtls_base64_encode(&enc_b64[0], enc_size * 2, &olen, &bin_enc[0], enc_size))
{ {
EXLOGE("BASE64 encode failed.\n"); EXLOGE("[core] BASE64 encode failed.\n");
return false; return false;
} }
enc_b64[olen] = 0; enc_b64[olen] = 0;
@ -123,13 +123,13 @@ bool ts_db_field_decrypt(const ex_astr& str_enc, ex_bin& bin_dec)
size_t enc_size = 0; size_t enc_size = 0;
if (0 != mbedtls_base64_decode(&bin_enc[0], bin_enc.size(), &enc_size, (const unsigned char*)str_enc.c_str(), str_enc.length())) if (0 != mbedtls_base64_decode(&bin_enc[0], bin_enc.size(), &enc_size, (const unsigned char*)str_enc.c_str(), str_enc.length()))
{ {
EXLOGE("BASE64 decode failed.\n"); EXLOGE("[core] BASE64 decode failed.\n");
return false; return false;
} }
bin_enc.resize(enc_size); bin_enc.resize(enc_size);
if (bin_enc.size() % 16 != 0) if (bin_enc.size() % 16 != 0)
{ {
EXLOGE("invalid cipher-data.\n"); EXLOGE("[core] invalid cipher-data.\n");
return false; return false;
} }
@ -143,7 +143,7 @@ bool ts_db_field_decrypt(const ex_astr& str_enc, ex_bin& bin_dec)
mbedtls_aes_init(&ctx); mbedtls_aes_init(&ctx);
if (0 != mbedtls_aes_setkey_dec(&ctx, g_db_field_aes_key, 256)) if (0 != mbedtls_aes_setkey_dec(&ctx, g_db_field_aes_key, 256))
{ {
EXLOGE("invalid AES key.\n"); EXLOGE("[core] invalid AES key.\n");
return false; return false;
} }
@ -152,7 +152,7 @@ bool ts_db_field_decrypt(const ex_astr& str_enc, ex_bin& bin_dec)
memset(iv, 0, 16); memset(iv, 0, 16);
if (0 != mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_DECRYPT, enc_size, iv, &bin_enc[0], &bin_tmp[0])) if (0 != mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_DECRYPT, enc_size, iv, &bin_enc[0], &bin_tmp[0]))
{ {
EXLOGE("AES-CBC decrypt failed.\n"); EXLOGE("[core] AES-CBC decrypt failed.\n");
mbedtls_aes_free(&ctx); mbedtls_aes_free(&ctx);
return false; return false;
} }
@ -162,13 +162,13 @@ bool ts_db_field_decrypt(const ex_astr& str_enc, ex_bin& bin_dec)
unsigned char pad = bin_tmp[bin_tmp.size() - 1]; unsigned char pad = bin_tmp[bin_tmp.size() - 1];
if (pad == 0 || pad > 16) if (pad == 0 || pad > 16)
{ {
EXLOGE("invalid padding.\n"); EXLOGE("[core] invalid padding.\n");
return false; return false;
} }
bin_tmp.resize(bin_tmp.size() - pad); bin_tmp.resize(bin_tmp.size() - pad);
if (bin_tmp.size() < 16) if (bin_tmp.size() < 16)
{ {
EXLOGE("invalid decrypted data.\n"); EXLOGE("[core] invalid decrypted data.\n");
return false; return false;
} }

View File

@ -42,30 +42,41 @@ bool TsEnv::init(bool load_config)
ex_path_join(conf_file, false, L"core.ini", NULL); ex_path_join(conf_file, false, L"core.ini", NULL);
m_replay_path = base_path; m_replay_path = base_path;
ex_path_join(m_replay_path, false, L"share", L"data", L"replay", NULL); ex_path_join(m_replay_path, false, L"share", L"replay", NULL);
log_path = base_path; log_path = base_path;
ex_path_join(log_path, false, L"share", L"log", NULL); ex_path_join(log_path, false, L"share", L"log", NULL);
} }
else // not in development mode else // not in development mode
{ {
#ifdef EX_OS_WIN32 // #ifdef EX_OS_WIN32
// base_path = m_exec_path;
// ex_path_join(base_path, true, L"..", NULL);
// m_etc_path = base_path;
// ex_path_join(m_etc_path, false, L"etc", NULL);
// conf_file = m_etc_path;
// ex_path_join(conf_file, false, L"core.ini", NULL);
// m_replay_path = base_path;
// ex_path_join(m_replay_path, false, L"data", L"replay", NULL);
// log_path = base_path;
// ex_path_join(log_path, false, L"log", NULL);
// #else
// m_etc_path = L"/etc/teleport";
// conf_file = L"/etc/teleport/core.ini";
// m_replay_path = L"/var/lib/teleport/replay";
// log_path = L"/var/log/teleport";
// #endif
base_path = m_exec_path; base_path = m_exec_path;
ex_path_join(base_path, true, L"..", NULL); ex_path_join(base_path, true, L"..", L"data", NULL);
m_etc_path = base_path; m_etc_path = base_path;
ex_path_join(m_etc_path, false, L"etc", NULL); ex_path_join(m_etc_path, false, L"etc", NULL);
conf_file = m_etc_path; conf_file = m_etc_path;
ex_path_join(conf_file, false, L"core.ini", NULL); ex_path_join(conf_file, false, L"core.ini", NULL);
m_replay_path = base_path; m_replay_path = base_path;
ex_path_join(m_replay_path, false, L"data", L"replay", NULL); ex_path_join(m_replay_path, false, L"replay", NULL);
log_path = base_path; log_path = base_path;
ex_path_join(log_path, false, L"log", NULL); ex_path_join(log_path, false, L"log", NULL);
#else
m_etc_path = L"/etc/teleport";
conf_file = L"/etc/teleport/core.ini";
m_replay_path = L"/var/lib/teleport/replay";
log_path = L"/var/log/teleport";
#endif
} }
//EXLOGW(L"[core] load config file: %ls.\n", conf_file.c_str()); //EXLOGW(L"[core] load config file: %ls.\n", conf_file.c_str());
@ -112,7 +123,7 @@ bool TsEnv::init(bool load_config)
} }
int debug_mode = 0; int debug_mode = 0;
ps->GetInt(L"debug", debug_mode, 0); ps->GetInt(L"debug-mode", debug_mode, 0);
if (debug_mode == 1) if (debug_mode == 1)
EXLOG_DEBUG(true); EXLOG_DEBUG(true);

View File

@ -55,14 +55,14 @@ TsHttpRpc::~TsHttpRpc()
void TsHttpRpc::_thread_loop(void) void TsHttpRpc::_thread_loop(void)
{ {
EXLOGV("[core-rpc] TeleportServer-HTTP-RPC ready on %s:%d\n", m_host_ip.c_str(), m_host_port); EXLOGV("[core] rpc TeleportServer-HTTP-RPC ready on %s:%d\n", m_host_ip.c_str(), m_host_port);
while(!m_stop_flag) while(!m_stop_flag)
{ {
mg_mgr_poll(&m_mg_mgr, 500); mg_mgr_poll(&m_mg_mgr, 500);
} }
EXLOGV("[core-rpc] main loop end.\n"); EXLOGV("[core] rpc main loop end.\n");
} }
void TsHttpRpc::_set_stop_flag(void) void TsHttpRpc::_set_stop_flag(void)
@ -90,7 +90,7 @@ bool TsHttpRpc::init(void)
nc = mg_bind(&m_mg_mgr, addr, _mg_event_handler); nc = mg_bind(&m_mg_mgr, addr, _mg_event_handler);
if (NULL == nc) if (NULL == nc)
{ {
EXLOGE("[core-rpc] listener failed to bind at %s.\n", addr); EXLOGE("[core] rpc listener failed to bind at %s.\n", addr);
return false; return false;
} }
@ -114,7 +114,7 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
TsHttpRpc* _this = (TsHttpRpc*)nc->user_data; TsHttpRpc* _this = (TsHttpRpc*)nc->user_data;
if (NULL == _this) if (NULL == _this)
{ {
EXLOGE("[core-rpc] invalid http request.\n"); EXLOGE("[core] rpc invalid http request.\n");
return; return;
} }
@ -127,7 +127,7 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
ex_astr uri; ex_astr uri;
uri.assign(hm->uri.p, hm->uri.len); uri.assign(hm->uri.p, hm->uri.len);
EXLOGD("got request: %s\n", uri.c_str()); EXLOGD("[core] rpc got request: %s\n", uri.c_str());
if (uri == "/rpc") if (uri == "/rpc")
{ {
@ -137,18 +137,18 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
ex_rv rv = _this->_parse_request(hm, method, json_param); ex_rv rv = _this->_parse_request(hm, method, json_param);
if (TSR_OK != rv) if (TSR_OK != rv)
{ {
EXLOGE("[core-rpc] got invalid request.\n"); EXLOGE("[core] rpc got invalid request.\n");
_this->_create_json_ret(ret_buf, rv); _this->_create_json_ret(ret_buf, rv);
} }
else else
{ {
EXLOGD("[core-rpc] got request method `%s`\n", method.c_str()); EXLOGD("[core] rpc got request method `%s`\n", method.c_str());
_this->_process_request(method, json_param, ret_buf); _this->_process_request(method, json_param, ret_buf);
} }
} }
else else
{ {
EXLOGE("[core-rpc] got invalid request: not `rpc` uri.\n"); EXLOGE("[core] rpc got invalid request: not `rpc` uri.\n");
_this->_create_json_ret(ret_buf, TSR_INVALID_REQUEST, "not a `rpc` request."); _this->_create_json_ret(ret_buf, TSR_INVALID_REQUEST, "not a `rpc` request.");
} }
@ -267,7 +267,7 @@ void TsHttpRpc::_process_request(const ex_astr& func_cmd, const Json::Value& jso
} }
else else
{ {
EXLOGE("[core-rpc] got unknown command: %s\n", func_cmd.c_str()); EXLOGE("[core] rpc got unknown command: %s\n", func_cmd.c_str());
_create_json_ret(buf, TSR_NO_SUCH_METHOD); _create_json_ret(buf, TSR_NO_SUCH_METHOD);
} }
} }
@ -428,7 +428,7 @@ void TsHttpRpc::_rpc_func_request_session(const Json::Value& json_param, ex_astr
return; return;
} }
EXLOGD("[core-rpc] new session-id: %s\n", sid.c_str()); EXLOGD("[core] rpc new session-id: %s\n", sid.c_str());
Json::Value jr_data; Json::Value jr_data;
jr_data["sid"] = sid; jr_data["sid"] = sid;
@ -594,7 +594,7 @@ void TsHttpRpc::_rpc_func_request_session(const Json::Value& json_param, ex_astr
// return; // return;
// } // }
// //
// EXLOGD("[core-rpc] new session-id: %s\n", sid.c_str()); // EXLOGD("[core] rpc new session-id: %s\n", sid.c_str());
// //
// Json::Value jr_root; // Json::Value jr_root;
// jr_root["code"] = TSR_OK; // jr_root["code"] = TSR_OK;

View File

@ -53,7 +53,7 @@ void TsSessionManager::_check_sessions(void)
if (_now - it->second->ticket_start >= 10000) if (_now - it->second->ticket_start >= 10000)
#endif #endif
{ {
EXLOGV("remove session: %s\n", it->first.c_str()); EXLOGV("[core] remove session: %s\n", it->first.c_str());
delete it->second; delete it->second;
m_sessions.erase(it++); m_sessions.erase(it++);
} }

View File

@ -1,6 +1,6 @@
#ifndef __TS_SERVER_VER_H__ #ifndef __TS_SERVER_VER_H__
#define __TS_SERVER_VER_H__ #define __TS_SERVER_VER_H__
#define TP_SERVER_VER L"2.2.7.3" #define TP_SERVER_VER L"2.2.8.1"
#endif // __TS_SERVER_VER_H__ #endif // __TS_SERVER_VER_H__

View File

@ -202,7 +202,7 @@ bool SshProxy::get_sftp_session_info(const ex_astr& sid, TS_SFTP_SESSION_INFO& i
ts_sftp_sessions::iterator it = m_sftp_sessions.find(sid); ts_sftp_sessions::iterator it = m_sftp_sessions.find(sid);
if (it == m_sftp_sessions.end()) if (it == m_sftp_sessions.end())
{ {
EXLOGD("sftp-session '%s' not exists.\n", sid.c_str()); EXLOGD("[ssh] sftp-session '%s' not exists.\n", sid.c_str());
return false; return false;
} }

View File

@ -51,7 +51,7 @@ void TppSshRec::_on_end(void)
FILE* f = ex_fopen(fname, L"wb"); FILE* f = ex_fopen(fname, L"wb");
if (NULL == f) if (NULL == f)
{ {
EXLOGE("[record] can not open file for write.\n"); EXLOGE("[ssh] can not open record file for write.\n");
return; return;
} }
@ -137,7 +137,7 @@ bool TppSshRec::_save_to_data_file(void)
if (NULL == f) if (NULL == f)
{ {
EXLOGE("[record] can not open data-file for write.\n"); EXLOGE("[ssh] can not open record data-file for write.\n");
m_cache.empty(); m_cache.empty();
return false; return false;
} }

Binary file not shown.

View File

@ -44,16 +44,16 @@ bool TsEnv::init(bool load_config)
base_path = m_exec_path; base_path = m_exec_path;
ex_path_join(base_path, true, L"..", NULL); ex_path_join(base_path, true, L"..", NULL);
#ifdef EX_OS_WIN32 // #ifdef EX_OS_WIN32
conf_file = base_path; conf_file = base_path;
ex_path_join(conf_file, false, L"etc", L"web.ini", NULL); ex_path_join(conf_file, false, L"data", L"etc", L"web.ini", NULL);
log_path = base_path; log_path = base_path;
ex_path_join(log_path, false, L"log", NULL); ex_path_join(log_path, false, L"data", L"log", NULL);
#else // #else
conf_file = L"/etc/teleport/web.ini"; // conf_file = L"/etc/teleport/web.ini";
log_path = L"/var/log/teleport"; // log_path = L"/var/log/teleport";
//
#endif // #endif
} }
m_www_path = base_path; m_www_path = base_path;
@ -74,7 +74,7 @@ bool TsEnv::init(bool load_config)
ex_wstr log_file; ex_wstr log_file;
ExIniSection* ps = cfg.GetDumySection(); ExIniSection* ps = cfg.GetDumySection();
if (!ps->GetStr(L"log_file", log_file)) if (!ps->GetStr(L"log-file", log_file))
{ {
EXLOG_FILE(L"tpweb.log", log_path.c_str()); EXLOG_FILE(L"tpweb.log", log_path.c_str());
} }
@ -95,11 +95,22 @@ bool TsEnv::init(bool load_config)
} }
int log_level = EX_LOG_LEVEL_INFO; int log_level = EX_LOG_LEVEL_INFO;
if (ps->GetInt(L"log_level", log_level)) if (ps->GetInt(L"log-level", log_level))
{ {
EXLOGV("[tpweb] log-level: %d\n", log_level); EXLOGV("[tpweb] log-level: %d\n", log_level);
EXLOG_LEVEL(log_level); EXLOG_LEVEL(log_level);
} }
int debug_mode = 0;
if (ps->GetInt(L"debug-mode", debug_mode))
{
EXLOGV("[tpweb] debug-mode: %d\n", debug_mode);
// EXLOG_LEVEL(log_level);
}
if (1 == debug_mode) {
EXLOG_LEVEL(EX_LOG_LEVEL_DEBUG);
}
return true; return true;
} }

View File

@ -1,6 +1,6 @@
#ifndef __TS_SERVER_VER_H__ #ifndef __TS_SERVER_VER_H__
#define __TS_SERVER_VER_H__ #define __TS_SERVER_VER_H__
#define TP_SERVER_VER L"2.2.7.3" #define TP_SERVER_VER L"2.2.8.1"
#endif // __TS_SERVER_VER_H__ #endif // __TS_SERVER_VER_H__

View File

@ -29,34 +29,19 @@ class WebServerCore:
cfg.app_path = os.path.abspath(options['app_path']) cfg.app_path = os.path.abspath(options['app_path'])
cfg.static_path = os.path.abspath(options['static_path']) cfg.static_path = os.path.abspath(options['static_path'])
cfg.data_path = os.path.abspath(options['data_path'])
cfg.template_path = os.path.abspath(options['template_path']) cfg.template_path = os.path.abspath(options['template_path'])
cfg.res_path = os.path.abspath(options['res_path']) cfg.res_path = os.path.abspath(options['res_path'])
cfg.cfg_path = os.path.abspath(options['cfg_path'])
cfg.log_path = os.path.abspath(options['log_path']) cfg.data_path = os.path.abspath(options['data_path'])
# cfg.cfg_path = os.path.abspath(options['cfg_path'])
# cfg.log_path = os.path.abspath(options['log_path'])
cfg.cfg_path = os.path.join(cfg.data_path, 'etc')
cfg.log_path = os.path.join(cfg.data_path, 'log')
_cfg_file = os.path.join(cfg.cfg_path, 'web.ini') _cfg_file = os.path.join(cfg.cfg_path, 'web.ini')
if not cfg.load(_cfg_file): if not cfg.load(_cfg_file):
return False return False
# _log_file, ok = cfg.get_str('common::log-file')
# if ok:
# cfg.log_path = os.path.abspath(os.path.dirname(_log_file))
# else:
# cfg.log_path = os.path.abspath(options['log_path'])
# _log_file = os.path.join(cfg.log_path, 'tpweb.log')
# cfg.set_default('common::log-file', _log_file)
#
# if not os.path.exists(cfg.log_path):
# utils.make_dir(cfg.log_path)
# if not os.path.exists(cfg.log_path):
# log.e('Can not create log path:{}\n'.format(cfg.log_path))
# return False
# log.set_attribute(min_level=cfg.common.log_level, filename=cfg.common.log_file)
# if cfg.common.debug_mode:
# log.set_attribute(min_level=log.LOG_DEBUG, trace_error=log.TRACE_ERROR_FULL)
return True return True
def _get_core_server_config(self): def _get_core_server_config(self):

View File

@ -53,7 +53,7 @@ class TPDatabase:
cfg = app_cfg() cfg = app_cfg()
if 'sqlite' == cfg.database.type: if 'sqlite' == cfg.database.type:
if cfg.database.sqlite_file is None: if cfg.database.sqlite_file is None:
cfg.set_default('database::sqlite-file', os.path.join(cfg.data_path, 'ts_db.db')) cfg.set_default('database::sqlite-file', os.path.join(cfg.data_path, 'db', 'ts_db.db'))
if not self._init_sqlite(cfg.database.sqlite_file): if not self._init_sqlite(cfg.database.sqlite_file):
return False return False
elif 'mysql' == cfg.database.type: elif 'mysql' == cfg.database.type:

View File

@ -14,10 +14,10 @@ import os
import platform import platform
import sys import sys
__all__ = ['PATH_APP_ROOT', 'PATH_LOG', 'PATH_CONF', 'PATH_DATA'] __all__ = ['PATH_APP_ROOT', 'PATH_DATA']
PATH_LOG = '' # PATH_LOG = ''
PATH_CONF = '' # PATH_CONF = ''
PATH_DATA = '' PATH_DATA = ''
# 将Python安装的扩展库移除避免开发调试与正式发布所依赖的库文件不一致导致发布的版本无法运行 # 将Python安装的扩展库移除避免开发调试与正式发布所依赖的库文件不一致导致发布的版本无法运行
@ -54,17 +54,17 @@ if _ext_path not in sys.path:
# 确定一些路径 # 确定一些路径
if os.path.exists(os.path.join(os.path.dirname(sys.executable), 'dev_mode')): if os.path.exists(os.path.join(os.path.dirname(sys.executable), 'dev_mode')):
# 开发调试模式 # 开发调试模式
PATH_LOG = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'share', 'log')) PATH_DATA = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'share'))
PATH_CONF = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'share', 'etc')) # PATH_LOG = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'share', 'log'))
PATH_DATA = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'share', 'data')) # PATH_CONF = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'share', 'etc'))
else: else:
PATH_LOG = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'log'))
PATH_CONF = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'etc'))
PATH_DATA = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'data')) PATH_DATA = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'data'))
# PATH_LOG = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'data', 'log'))
# PATH_CONF = os.path.abspath(os.path.join(PATH_APP_ROOT, '..', '..', 'data', 'etc'))
if PLATFORM == 'linux': # if PLATFORM == 'linux':
# 根据Linux目录规范建议设置各个必要的路径 # # 根据Linux目录规范建议设置各个必要的路径
PATH_LOG = '/var/log/teleport' # PATH_LOG = '/var/log/teleport'
PATH_CONF = '/etc/teleport' # PATH_CONF = '/etc/teleport'
PATH_DATA = '/var/lib/teleport' # PATH_DATA = '/var/lib/teleport'

View File

@ -12,10 +12,10 @@ def main():
'app_path': PATH_APP_ROOT, 'app_path': PATH_APP_ROOT,
# cfg_path 网站配置文件路径 # cfg_path 网站配置文件路径
'cfg_path': PATH_CONF, # 'cfg_path': PATH_CONF,
# log_path 网站运行时日志文件路径 # log_path 网站运行时日志文件路径
'log_path': PATH_LOG, # 'log_path': PATH_LOG,
# static_path 网站静态文件路径 # static_path 网站静态文件路径
'static_path': os.path.join(PATH_APP_ROOT, 'static'), 'static_path': os.path.join(PATH_APP_ROOT, 'static'),

View File

@ -1,4 +1,4 @@
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
TS_VER = "2.2.7.3" TS_VER = "2.2.8.1"
TP_ASSIST_LAST_VER = "2.2.5.1" TP_ASSIST_LAST_VER = "2.2.6.1"
TP_ASSIST_REQUIRE = "2.0.0.1" TP_ASSIST_REQUIRE = "2.0.0.1"

View File

@ -59,13 +59,6 @@
## } ## }
## ] ## ]
## }, ## },
{
'require_type': 100,
'id': 'config',
'link': '/config',
'name': '配置管理',
'icon': 'fa-cogs',
},
{ {
'require_type': 100, 'require_type': 100,
'id': 'log', 'id': 'log',
@ -73,6 +66,13 @@
'name': '日志查询', 'name': '日志查询',
'icon': 'fa-database', 'icon': 'fa-database',
}, },
{
'require_type': 100,
'id': 'config',
'link': '/config',
'name': '配置管理',
'icon': 'fa-cogs',
},
{ {
'separator': true, 'separator': true,
'require_type': 1, 'require_type': 1,

View File

@ -14,6 +14,6 @@ Build 构建号。构建号用于表明此版本发布之前进行了多少
TELEPORT_SERVER 2.2.7.3 TELEPORT_SERVER 2.2.8.1
TELEPORT_ASSIST 2.2.6.1 TELEPORT_ASSIST 2.2.6.1
TELEPORT_ASSIST_REQUIRE 2.0.0.1 TELEPORT_ASSIST_REQUIRE 2.0.0.1