diff --git a/cmd/dkl-local-server/main.go b/cmd/dkl-local-server/main.go
index bf4692b..8ac814a 100644
--- a/cmd/dkl-local-server/main.go
+++ b/cmd/dkl-local-server/main.go
@@ -21,13 +21,15 @@ const (
etcDir = "/etc/direktil"
)
+var Version = "dev"
+
var (
address = flag.String("address", ":7606", "HTTP listen address")
tlsAddress = flag.String("tls-address", "", "HTTPS listen address")
certFile = flag.String("tls-cert", etcDir+"/server.crt", "Server TLS certificate")
keyFile = flag.String("tls-key", etcDir+"/server.key", "Server TLS key")
- autoUnlock = flag.String("auto-unlock", "", "Auto-unlock store (testing only!)")
+ autoUnlock = flag.String("auto-unlock", "", "Auto-unlock store (testing only!) env: DLS_AUTO_UNLOCK")
casStore cas.Store
)
@@ -41,6 +43,9 @@ func main() {
log.Fatal("no listen address given")
}
+ log.Print("Direktil local-server version ", Version)
+ wPublicState.Change(func(s *PublicState) { s.ServerVersion = Version })
+
computeUIHash()
openSecretStore()
diff --git a/cmd/dkl-local-server/state.go b/cmd/dkl-local-server/state.go
index e71542a..9397a17 100644
--- a/cmd/dkl-local-server/state.go
+++ b/cmd/dkl-local-server/state.go
@@ -8,8 +8,9 @@ import (
)
type PublicState struct {
- UIHash string
- Store struct {
+ ServerVersion string
+ UIHash string
+ Store struct {
New bool
Open bool
}
diff --git a/hack/build b/hack/build
new file mode 100755
index 0000000..d61f0e1
--- /dev/null
+++ b/hack/build
@@ -0,0 +1,3 @@
+#! /bin/sh
+set -ex
+go build -o dist/ -trimpath -ldflags "-X main.Version=$(git describe --always --dirty)" $*
diff --git a/html/ui/index.html b/html/ui/index.html
index 06e8684..865568f 100644
--- a/html/ui/index.html
+++ b/html/ui/index.html
@@ -22,7 +22,8 @@
- ui {{ uiHash || '-----' }}
+ server {{ serverVersion || '-----' }}
+ ui {{ uiHash || '-----' }}
🗲
diff --git a/html/ui/js/app.js b/html/ui/js/app.js
index 87368f4..2ed94e8 100644
--- a/html/ui/js/app.js
+++ b/html/ui/js/app.js
@@ -16,6 +16,7 @@ createApp({
session: {},
error: null,
publicState: null,
+ serverVersion: null,
uiHash: null,
watchingState: false,
state: null,
@@ -41,6 +42,7 @@ createApp({
deep: true,
handler(v) {
if (v) {
+ this.serverVersion = v.ServerVersion
if (this.uiHash && v.UIHash != this.uiHash) {
console.log("reloading")
location.reload()
diff --git a/modd.conf b/modd.conf
index 201e5df..426c157 100644
--- a/modd.conf
+++ b/modd.conf
@@ -3,13 +3,13 @@ modd.conf {}
**/*.go go.mod go.sum {
prep: go test ./...
prep: mkdir -p dist
- prep: go build -o dist/ -trimpath ./...
+ prep: hack/build ./...
#prep: docker build --build-arg GOPROXY=$GOPROXY -t dls .
#daemon +sigterm: /var/lib/direktil/test-run
}
html/**/* {
- prep: go build -o dist/ -trimpath ./cmd/dkl-local-server
+ prep: hack/build ./cmd/dkl-local-server
}
dist/dkl-local-server {