add server version/commit in logs and UI
This commit is contained in:
parent
41897c00b4
commit
f7b708ce4b
@ -21,13 +21,15 @@ const (
|
|||||||
etcDir = "/etc/direktil"
|
etcDir = "/etc/direktil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Version = "dev"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
address = flag.String("address", ":7606", "HTTP listen address")
|
address = flag.String("address", ":7606", "HTTP listen address")
|
||||||
tlsAddress = flag.String("tls-address", "", "HTTPS listen address")
|
tlsAddress = flag.String("tls-address", "", "HTTPS listen address")
|
||||||
certFile = flag.String("tls-cert", etcDir+"/server.crt", "Server TLS certificate")
|
certFile = flag.String("tls-cert", etcDir+"/server.crt", "Server TLS certificate")
|
||||||
keyFile = flag.String("tls-key", etcDir+"/server.key", "Server TLS key")
|
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
|
casStore cas.Store
|
||||||
)
|
)
|
||||||
@ -41,6 +43,9 @@ func main() {
|
|||||||
log.Fatal("no listen address given")
|
log.Fatal("no listen address given")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Print("Direktil local-server version ", Version)
|
||||||
|
wPublicState.Change(func(s *PublicState) { s.ServerVersion = Version })
|
||||||
|
|
||||||
computeUIHash()
|
computeUIHash()
|
||||||
|
|
||||||
openSecretStore()
|
openSecretStore()
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type PublicState struct {
|
type PublicState struct {
|
||||||
|
ServerVersion string
|
||||||
UIHash string
|
UIHash string
|
||||||
Store struct {
|
Store struct {
|
||||||
New bool
|
New bool
|
||||||
|
3
hack/build
Executable file
3
hack/build
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
set -ex
|
||||||
|
go build -o dist/ -trimpath -ldflags "-X main.Version=$(git describe --always --dirty)" $*
|
@ -22,7 +22,8 @@
|
|||||||
<button class="link" @click="copyText(session.token)">🗐</button>
|
<button class="link" @click="copyText(session.token)">🗐</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span id="uiHash">ui <code>{{ uiHash || '-----' }}</code></span>
|
<span>server <code>{{ serverVersion || '-----' }}</code></span>
|
||||||
|
<span>ui <code>{{ uiHash || '-----' }}</code></span>
|
||||||
|
|
||||||
<span :class="publicState ? 'green' : 'red'">🗲</span>
|
<span :class="publicState ? 'green' : 'red'">🗲</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,6 +16,7 @@ createApp({
|
|||||||
session: {},
|
session: {},
|
||||||
error: null,
|
error: null,
|
||||||
publicState: null,
|
publicState: null,
|
||||||
|
serverVersion: null,
|
||||||
uiHash: null,
|
uiHash: null,
|
||||||
watchingState: false,
|
watchingState: false,
|
||||||
state: null,
|
state: null,
|
||||||
@ -41,6 +42,7 @@ createApp({
|
|||||||
deep: true,
|
deep: true,
|
||||||
handler(v) {
|
handler(v) {
|
||||||
if (v) {
|
if (v) {
|
||||||
|
this.serverVersion = v.ServerVersion
|
||||||
if (this.uiHash && v.UIHash != this.uiHash) {
|
if (this.uiHash && v.UIHash != this.uiHash) {
|
||||||
console.log("reloading")
|
console.log("reloading")
|
||||||
location.reload()
|
location.reload()
|
||||||
|
@ -3,13 +3,13 @@ modd.conf {}
|
|||||||
**/*.go go.mod go.sum {
|
**/*.go go.mod go.sum {
|
||||||
prep: go test ./...
|
prep: go test ./...
|
||||||
prep: mkdir -p dist
|
prep: mkdir -p dist
|
||||||
prep: go build -o dist/ -trimpath ./...
|
prep: hack/build ./...
|
||||||
#prep: docker build --build-arg GOPROXY=$GOPROXY -t dls .
|
#prep: docker build --build-arg GOPROXY=$GOPROXY -t dls .
|
||||||
#daemon +sigterm: /var/lib/direktil/test-run
|
#daemon +sigterm: /var/lib/direktil/test-run
|
||||||
}
|
}
|
||||||
|
|
||||||
html/**/* {
|
html/**/* {
|
||||||
prep: go build -o dist/ -trimpath ./cmd/dkl-local-server
|
prep: hack/build ./cmd/dkl-local-server
|
||||||
}
|
}
|
||||||
|
|
||||||
dist/dkl-local-server {
|
dist/dkl-local-server {
|
||||||
|
Loading…
Reference in New Issue
Block a user