mirror of
https://github.com/emqx/neuron.git
synced 2026-10-18 13:41:22 +08:00
Merge pull request #938 from fengzeroz/main
jwt: load key from config and persistence dir
This commit is contained in:
@@ -1025,7 +1025,7 @@ static int level_check(void *usr_data)
|
||||
gettimeofday(&tv, NULL);
|
||||
diff = tv.tv_sec - adapter->timestamp_lev;
|
||||
if (delay_s <= diff) {
|
||||
int ret = zlog_level_switch(ct, ZLOG_LEVEL_INFO);
|
||||
int ret = zlog_level_switch(ct, default_log_level);
|
||||
if (0 != ret) {
|
||||
nlog_error("Modify default log level fail, ret:%d", ret);
|
||||
}
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ static int manager_level_check(void *usr_data)
|
||||
gettimeofday(&tv, NULL);
|
||||
diff = tv.tv_sec - manager->timestamp_lev_manager;
|
||||
if (delay_s <= diff) {
|
||||
int ret = zlog_level_switch(neuron, ZLOG_LEVEL_INFO);
|
||||
int ret = zlog_level_switch(neuron, default_log_level);
|
||||
if (0 != ret) {
|
||||
nlog_error("Modify default log level fail, ret:%d", ret);
|
||||
}
|
||||
|
||||
+8
-2
@@ -92,7 +92,7 @@ static char *load_key(const char *dir, char *name)
|
||||
return content;
|
||||
}
|
||||
|
||||
int neu_jwt_init(const char *dir_path)
|
||||
static void scanf_key(const char *dir_path)
|
||||
{
|
||||
DIR * dir = NULL;
|
||||
struct dirent *ptr = NULL;
|
||||
@@ -100,7 +100,7 @@ int neu_jwt_init(const char *dir_path)
|
||||
dir = opendir(dir_path);
|
||||
if (dir == NULL) {
|
||||
zlog_error(neuron, "Open dir error: %s", strerror(errno));
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
while (NULL != (ptr = readdir(dir))) {
|
||||
@@ -127,6 +127,12 @@ int neu_jwt_init(const char *dir_path)
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
int neu_jwt_init(const char *dir_path)
|
||||
{
|
||||
scanf_key(dir_path);
|
||||
scanf_key("persistence");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user