mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-08-19 15:28:46 +00:00
Add debug mode for seafdav (#641)
* Add debug mode for seafdav * Use seafdav conf --------- Co-authored-by: yangheran <heran.yang@seafile.com>
This commit is contained in:
parent
ce8a8db6c6
commit
67dd1468cf
@ -370,6 +370,22 @@ start_seafdav() {
|
|||||||
char port[16];
|
char port[16];
|
||||||
snprintf (port, sizeof(port), "%d", conf.port);
|
snprintf (port, sizeof(port), "%d", conf.port);
|
||||||
|
|
||||||
|
int pid;
|
||||||
|
if (conf.debug_mode) {
|
||||||
|
char *argv[] = {
|
||||||
|
(char *)get_python_executable(),
|
||||||
|
"-m", "wsgidav.server.server_cli",
|
||||||
|
"--server", "gunicorn",
|
||||||
|
"--root", "/",
|
||||||
|
"--log-file", seafdav_log_file,
|
||||||
|
"--pid", ctl->pidfile[PID_SEAFDAV],
|
||||||
|
"--port", port,
|
||||||
|
"--host", conf.host,
|
||||||
|
"-v",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
pid = spawn_process (argv, true);
|
||||||
|
} else {
|
||||||
char *argv[] = {
|
char *argv[] = {
|
||||||
(char *)get_python_executable(),
|
(char *)get_python_executable(),
|
||||||
"-m", "wsgidav.server.server_cli",
|
"-m", "wsgidav.server.server_cli",
|
||||||
@ -381,8 +397,8 @@ start_seafdav() {
|
|||||||
"--host", conf.host,
|
"--host", conf.host,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
pid = spawn_process (argv, true);
|
||||||
int pid = spawn_process (argv, true);
|
}
|
||||||
|
|
||||||
if (pid <= 0) {
|
if (pid <= 0) {
|
||||||
seaf_warning ("Failed to spawn seafdav\n");
|
seaf_warning ("Failed to spawn seafdav\n");
|
||||||
@ -779,6 +795,15 @@ read_seafdav_config()
|
|||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctl->seafdav_config.debug_mode = g_key_file_get_boolean (key_file, "WEBDAV", "debug", &error);
|
||||||
|
if (error != NULL) {
|
||||||
|
if (error->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND) {
|
||||||
|
seaf_message ("Error when reading WEBDAV.debug, use deafult value FALSE\n");
|
||||||
|
}
|
||||||
|
ctl->seafdav_config.debug_mode = FALSE;
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
|
||||||
if (ctl->seafdav_config.port <= 0 || ctl->seafdav_config.port > 65535) {
|
if (ctl->seafdav_config.port <= 0 || ctl->seafdav_config.port > 65535) {
|
||||||
seaf_warning("Failed to load seafdav config: invalid port %d\n", ctl->seafdav_config.port);
|
seaf_warning("Failed to load seafdav config: invalid port %d\n", ctl->seafdav_config.port);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
@ -35,6 +35,7 @@ typedef struct SeafDavConfig {
|
|||||||
gboolean enabled;
|
gboolean enabled;
|
||||||
int port;
|
int port;
|
||||||
char *host;
|
char *host;
|
||||||
|
gboolean debug_mode;
|
||||||
|
|
||||||
} SeafDavConfig;
|
} SeafDavConfig;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user