forked from newrelic/newrelic-pcf-nozzle-tile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (33 loc) · 843 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"github.com/newrelic/newrelic-pcf-nozzle-tile/config"
"github.com/newrelic/newrelic-pcf-nozzle-tile/newrelic"
)
// Version uses -ldflags "-X main.Version=$(git describe)"
var Version string
func main() {
version()
interupt := make(chan os.Signal, 1)
signal.Notify(interupt, os.Interrupt, os.Kill, syscall.SIGTERM)
newrelic.Start(interupt)
}
func inArgs(a string) bool {
args := strings.Join(os.Args, ",")
return strings.Contains(args, a)
}
func version() {
if len(Version) > 0 {
config.Get().Set("Version", Version)
}
if inArgs("version") {
fmt.Printf("\nNew Relic PCF Firehose Agent: %s\n\n", config.Get().GetString("Version"))
os.Exit(0)
}
}