aboutsummaryrefslogtreecommitdiff
path: root/awwan.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-22 13:16:21 +0700
committerShulhan <ms@kilabit.info>2023-12-01 13:17:30 +0700
commita73f0d5d0108e2e10d89f93c7867addbe073add9 (patch)
tree042e69e2c1d10d836a006abca37417af02bba826 /awwan.go
parenta9701f66c2e38a3a7f3d12deed6ebba5144e208e (diff)
downloadawwan-a73f0d5d0108e2e10d89f93c7867addbe073add9.tar.xz
all: refactoring HTTP endpoint for Execute
Previously, the Execute endpoint wait for command execution to finish. In case the command takes longer than proxy or server write timeout, it will return with an timeout error to client. In this changes, we generate an execution ID for each request and return it immediately. The next commit will implement HTTP endpoint to fetch the latest status and/or output by execution ID. References: https://todo.sr.ht/~shulhan/awwan/5
Diffstat (limited to 'awwan.go')
-rw-r--r--awwan.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/awwan.go b/awwan.go
index 5752f4b..1b769bb 100644
--- a/awwan.go
+++ b/awwan.go
@@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"strings"
+ "time"
"github.com/shuLhan/share/lib/ini"
"github.com/shuLhan/share/lib/ssh/config"
@@ -25,6 +26,11 @@ var Version = `0.9.0`
// directory of workspace.
var osGetwd = os.Getwd
+// timeNow define a function that return the current time.
+//
+// This variable will be overriden in testing to mock time.
+var timeNow = time.Now
+
// List of command available for program awwan.
const (
CommandModeDecrypt = `decrypt`