aboutsummaryrefslogtreecommitdiff
path: root/http_server.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-10-30 19:31:06 +0700
committerShulhan <ms@kilabit.info>2023-10-30 19:31:06 +0700
commit4726a28cee89f542eb3b0569639069a05d1df6b0 (patch)
tree8ba5cd33f4f53387f183464088f98d556a9a7e45 /http_server.go
parent5b6f533771e01e992e471d0e777d542c1526cf10 (diff)
downloadawwan-4726a28cee89f542eb3b0569639069a05d1df6b0.tar.xz
all: log all execution into file
For each script execution, a file suffixed with ".log" will be created in the same directory with the same name as script file. For example, if the script is path is "a/b/c.aww" then the log file would named "a/b/c.aww.log". This is to provides history and audit in the future.
Diffstat (limited to 'http_server.go')
-rw-r--r--http_server.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/http_server.go b/http_server.go
index 4b667a4..d06647e 100644
--- a/http_server.go
+++ b/http_server.go
@@ -408,7 +408,12 @@ func (httpd *httpServer) awwanApiExecute(epr *libhttp.EndpointRequest) (resb []b
req.Script = filepath.Join(httpd.memfsBase.Opts.Root, req.Script)
req.lineRange = parseLineRange(req.LineRange)
- req.init()
+
+ err = req.init()
+ if err != nil {
+ res.Message = fmt.Sprintf(`%s: %s`, logp, err)
+ return nil, res
+ }
var (
data = &HttpResponse{