make sync command configurable via appsettings
This commit is contained in:
1 parent
dbaad6b372
commit
bc9944c5f2
2 files changed
+10
-4
No files matched your search
+6
-3
@@ -213,12 +213,15 @@ app.MapGet("/api/entry-chains", (Func<SqliteConnection> factory, string from, st
|
|||||||
// POST /api/sync - run export.mjs to import new entries
|
// POST /api/sync - run export.mjs to import new entries
|
||||||
app.MapPost("/api/sync", async () =>
|
app.MapPost("/api/sync", async () =>
|
||||||
{
|
{
|
||||||
var wd = "/home/node/.openclaw/workspace/projects/token-analytics/jsonl-sync";
|
var config = app.Configuration;
|
||||||
var psi = new System.Diagnostics.ProcessStartInfo("docker", $"exec meleki node {wd}/export.mjs")
|
var wd = config["SyncWorkingDirectory"] ?? "/opt/token-analytics/jsonl-sync";
|
||||||
|
var fileName = config["SyncCommandFileName"] ?? "node";
|
||||||
|
var arguments = config["SyncCommandArguments"] ?? "/opt/token-analytics/jsonl-sync/export.mjs";
|
||||||
|
var psi = new System.Diagnostics.ProcessStartInfo(fileName, arguments)
|
||||||
{
|
{
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = true,
|
||||||
WorkingDirectory = wd!
|
WorkingDirectory = wd
|
||||||
};
|
};
|
||||||
var proc = System.Diagnostics.Process.Start(psi)!;
|
var proc = System.Diagnostics.Process.Start(psi)!;
|
||||||
var stdout = await proc.StandardOutput.ReadToEndAsync();
|
var stdout = await proc.StandardOutput.ReadToEndAsync();
|
||||||
|
|||||||
+4
-1
@@ -7,5 +7,8 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Urls": "http://0.0.0.0:18684",
|
"Urls": "http://0.0.0.0:18684",
|
||||||
"DbPath": "jsonl-sync/sessions.db"
|
"DbPath": "jsonl-sync/sessions.db",
|
||||||
|
"SyncWorkingDirectory": "/home/node/.openclaw/workspace/projects/token-analytics/jsonl-sync",
|
||||||
|
"SyncCommandFileName": "docker",
|
||||||
|
"SyncCommandArguments": "exec meleki node /home/node/.openclaw/workspace/projects/token-analytics/jsonl-sync/export.mjs"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user