Skip to content

Commit 75c8c49

Browse files
committed
Fix status.json info
1 parent 7d9488a commit 75c8c49

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

docker-run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ set -o errexit
66
set -o pipefail
77
set -o nounset
88

9-
docker build -t regexplanet-go .
9+
docker build \
10+
--build-arg COMMIT=$(git rev-parse --short HEAD)-local \
11+
--build-arg LASTMOD=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
12+
--tag regexplanet-go \
13+
.
14+
1015
docker run \
1116
--publish 4000:4000 \
1217
--expose 4000 \
1318
--env PORT='4000' \
14-
--env COMMIT=$(git rev-parse --short HEAD) \
15-
--env LASTMOD=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
1619
regexplanet-go

main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,18 @@ type Status struct {
5757
TempDir string
5858
}
5959

60+
var COMMIT string
61+
var LASTMOD string
62+
6063
func status_handler(w http.ResponseWriter, r *http.Request) {
6164
var err error
6265
status := Status{}
6366

6467
status.Success = true
6568
status.Message = "OK"
6669
status.Timestamp = time.Now().UTC().Format(time.RFC3339)
67-
status.Commit = os.Getenv("COMMIT")
68-
status.Lastmod = os.Getenv("LASTMOD")
70+
status.Commit = COMMIT
71+
status.Lastmod = LASTMOD
6972
status.Tech = runtime.Version()
7073

7174
status.Getwd, err = os.Getwd()
@@ -79,7 +82,7 @@ func status_handler(w http.ResponseWriter, r *http.Request) {
7982
}
8083

8184
status.TempDir = os.TempDir()
82-
status.Version = runtime.Version()
85+
status.Version = runtime.Version()[2:] // remove "go" prefix
8386
status.Seconds = time.Now().Unix()
8487

8588
write_with_callback(w, r.FormValue("callback"), status)

0 commit comments

Comments
 (0)