aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2021-01-24 12:36:39 -0500
committerMitch Riedstra <mitch@riedstra.us>2021-01-24 12:36:39 -0500
commit023ce2fd00c2269202969c1750e237a6c9c8f985 (patch)
tree0eb54e9bffd3acad657182f62cda0bd97836ba46
parentbad568d0a26ad348f25a4556266ba98f73b3be02 (diff)
downloadcheckup-023ce2fd00c2269202969c1750e237a6c9c8f985.tar.gz
checkup-023ce2fd00c2269202969c1750e237a6c9c8f985.tar.xz
Add a build script, license and version.
-rw-r--r--.gitignore1
-rw-r--r--LICENSE13
-rwxr-xr-xbuild.sh20
-rw-r--r--cmd/main/main.go8
-rw-r--r--load.go1
-rw-r--r--sample-config.yml3
6 files changed, 45 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index db9a660..23bf50c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
cmd/main/main
config.yml
+checkup
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b10b656
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+Copyright 2021 Mitchell Riedstra
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..2a92868
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+set -e
+
+LICENSE="$(cat LICENSE)"
+
+version="$(git log --format="%h %d" -1)
+$(go version)
+Build Date: $(date +%m.%d.%Y)
+Source code can be found here:
+https://git.riedstra.dev/go/checkup
+
+$LICENSE"
+
+if ! git diff-index --quiet HEAD ; then
+ version="dirty: $version"
+fi
+
+export CGO_ENABLED=0
+
+go build -o checkup -ldflags="-X 'main.Version=$version'" ./cmd/main
diff --git a/cmd/main/main.go b/cmd/main/main.go
index c81a329..2e11184 100644
--- a/cmd/main/main.go
+++ b/cmd/main/main.go
@@ -9,6 +9,8 @@ import (
"riedstra.dev/go/checkup"
)
+var Version = "Development"
+
type Config struct {
RocketChatURL string `yaml:"RocketChatURL"`
DiscordURL string `yaml:"DiscordURL"`
@@ -59,9 +61,15 @@ func main() {
fl := flag.NewFlagSet("checkup", flag.ExitOnError)
confFn := fl.String("c", "config.yml", "Configuration file path")
+ version := fl.Bool("v", false, "Print version and exit")
_ = fl.Parse(os.Args[1:])
+ if *version {
+ fmt.Println(Version)
+ os.Exit(0)
+ }
+
conf, err := ReadConfig(*confFn)
if err != nil {
fmt.Fprintln(os.Stderr, err)
diff --git a/load.go b/load.go
deleted file mode 100644
index 39e534d..0000000
--- a/load.go
+++ /dev/null
@@ -1 +0,0 @@
-package checkup
diff --git a/sample-config.yml b/sample-config.yml
index dadbc0a..0447a3e 100644
--- a/sample-config.yml
+++ b/sample-config.yml
@@ -2,6 +2,9 @@
RocketChatURL: changeme
DiscordURL: changeme
+# How many concurrent requests do we run?
+Workers: 10
+
DefaultCertPort: '443'
# In Days
CertWindow: 15