mirror of
https://github.com/SirHumza/orbisRPC.git
synced 2026-10-23 06:01:37 +02:00
daemon: reload config before each token attempt
The daemon loaded config once at startup and held it in memory, so an operator editing auth_code/refresh_token on the console (FTP) while it ran was ignored. Re-read the disk config each ensure_token() so edits take effect live without a plugin reload.
This commit is contained in:
1 parent
d5d1957668
commit
91382fc53c
1 file changed
+4
@@ -28,6 +28,10 @@ void daemon_request_stop(void){ s_stop = 1; }
|
||||
void daemon_clear_stop(void){ s_stop = 0; }
|
||||
|
||||
static int ensure_token(void){
|
||||
/* Re-read config each attempt: the operator edits auth_code/refresh_token
|
||||
* on the console (FTP) while the daemon runs, and cfg_save() persists new
|
||||
* tokens after refresh — the disk file is the source of truth. */
|
||||
cfg_load(CFG_PATH, &g_cfg);
|
||||
int64_t now=time(NULL);
|
||||
if(g_cfg.access_token[0] && now < g_cfg.token_expires_at - 120) return 0; /* fresh */
|
||||
char at[256]="", rt[256]=""; int64_t exp=0;
|
||||
|
||||
Reference in new issue
Block a user