Skip to content

Commit

Permalink
support country ip whitelisting, fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jpillora committed Sep 8, 2019
1 parent 0e15e52 commit b26a1a6
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
tmp/
27 changes: 27 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- freebsd
- windows
- android
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 6
- 7
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ $ webproc --help
--port, -p listening port (default 8080, env PORT)
--user, -u basic auth username (env HTTP_USER)
--pass basic auth password (env HTTP_PASS)
--allowed-ip, -a allowed ip or cidr block (allows multiple)
--allow-ip, -a allow ip or cidr block (allows multiple)
--allow-country, -y allow ip range by 2-letter ISO country code (allows multiple)
--trust-proxy, -t trust proxy HTTP headers to provide remote ip address
--log, -l log mode (must be 'webui' or 'proxy' or 'both' defaults to 'both')
--on-exit, -o process exit action (default ignore)
--configuration-file, -c configuration file (allows multiple)
--configuration-file, -c writable configuration file (allows multiple)
--restart-timeout, -r restart timeout controls when to perform a force kill (default 30s)
--max-lines, -m maximum number of log lines to show in webui (default 5000)
--version, -v display version
--help display help
Version:
0.0.0-src
X.Y.Z
Read more:
https://github.com/jpillora/webproc
Expand Down
21 changes: 17 additions & 4 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,28 @@ func Run(version string, c Config) error {
h = cookieauth.Wrap(h, c.User, c.Pass)
}
//2. ipfilter middlware
if len(c.AllowedIPs) > 0 {
if len(c.AllowedIPs) > 0 || len(c.AllowedCountries) > 0 {
if len(c.AllowedIPs) == 0 {
a.log.Printf("auto-allow localhost (127.0.0.1)")
c.AllowedIPs = append(c.AllowedIPs, "127.0.0.1")
}
h = ipfilter.Wrap(h, ipfilter.Options{
AllowedIPs: c.AllowedIPs,
BlockByDefault: true,
AllowedIPs: c.AllowedIPs,
AllowedCountries: c.AllowedCountries,
TrustProxy: c.TrustProxy,
BlockByDefault: true,
Logger: a.log,
})
}
//1. log middleware (log everything!)
var reqlogs io.Writer
if c.Log == LogWebUI {
reqlogs = agentWriter
} else {
io.MultiWriter(os.Stdout, agentWriter)
}
h = requestlog.WrapWith(h, requestlog.Options{
Writer: agentWriter,
Writer: reqlogs,
Colors: &requestlog.Colors{},
Format: `[webproc] {{ if .Timestamp }}{{ .Timestamp }} {{end}}` +
`{{ .Method }} {{ .Path }} {{ .Code }} ` +
Expand Down
14 changes: 12 additions & 2 deletions agent/agent_proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,18 @@ func (a *agent) runProcOnce(prog string, c Config) int {
if wd, err := os.Getwd(); err == nil {
proc.Dir = wd
}
proc.Stdout = io.MultiWriter(os.Stdout, &msgQueuer{"out", a.msgQueue})
proc.Stderr = io.MultiWriter(os.Stderr, &msgQueuer{"err", a.msgQueue})
stdout := []io.Writer{}
stderr := []io.Writer{}
if c.Log == LogBoth || c.Log == LogProxy {
stdout = append(stdout, os.Stdout)
stderr = append(stdout, os.Stderr)
}
if c.Log == LogBoth || c.Log == LogWebUI {
stdout = append(stdout, &msgQueuer{"out", a.msgQueue})
stderr = append(stdout, &msgQueuer{"err", a.msgQueue})
}
proc.Stdout = io.MultiWriter(stdout...)
proc.Stderr = io.MultiWriter(stderr...)
proc.Stdin = os.Stdin
if err := proc.Start(); err != nil {
a.log.Fatalf("program failed to start: %s", err)
Expand Down
4 changes: 3 additions & 1 deletion agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ type Config struct {
Port int `opts:"help=listening port, default=8080, env=PORT"`
User string `opts:"help=basic auth username, env=HTTP_USER"`
Pass string `opts:"help=basic auth password, env=HTTP_PASS"`
AllowedIPs []string `opts:"name=allowed-ip, help=allowed ip or cidr block"`
AllowedIPs []string `opts:"name=allow-ip, help=allow ip or cidr block"`
AllowedCountries []string `opts:"name=allow-country, short=y, help=allow ip range by 2-letter ISO country code"`
TrustProxy bool `opts:"help=trust proxy HTTP headers to provide remote ip address"`
ProgramArgs []string `opts:"mode=arg, name=arg, help=args can be either a command with arguments or a webproc file, min=1"`
Log Log `opts:"help=log mode (must be 'webui' or 'proxy' or 'both' defaults to 'both')"`
OnExit OnExit `opts:"help=process exit action, default=ignore"`
Expand Down
12 changes: 11 additions & 1 deletion agent/static/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ main {
overflow-y: auto;
}
.controls .files {
margin-bottom: 20px;
margin-bottom: 10px;
}
.controls .files .grouped.fields {
text-align: left;
}
.controls .files .ui.radio label {
word-break: break-all;
text-align: left;
}
.controls .checkmark.icon {
margin: 0;
Expand Down Expand Up @@ -103,6 +110,9 @@ main {
.ui.checkbox label {
cursor: pointer;
}
.ui.form .field {
margin: 0 0 0.5em;
}

/*===================================*/

Expand Down
18 changes: 12 additions & 6 deletions agent/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ <h1 class="title">
</div>
<div class="files" ng-show="files.length > 1">
<div class="ui title info field">Files</div>
<div class="ui field">
<select
class="ui button"
ng-options="f for f in files"
ng-model="inputs.file"
></select>
<div class="grouped fields">
<div class="field" ng-repeat="f in files">
<div class="ui radio checkbox">
<input
type="radio"
id="{{ $index }}"
ng-model="inputs.file"
ng-value="f"
/>
<label for="{{ $index }}">{{ f }}</label>
</div>
</div>
</div>
</div>
<div class="ui title info field">Logging</div>
Expand Down
5 changes: 4 additions & 1 deletion agent/statik/statik.go

Large diffs are not rendered by default.

23 changes: 10 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
module github.com/jpillora/webproc

go 1.13

require (
github.com/NYTimes/gziphandler v1.0.1
github.com/NYTimes/gziphandler v1.1.1
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect
github.com/elazarl/go-bindata-assetfs v1.0.0
github.com/elithrar/simple-scrypt v1.3.0 // indirect
github.com/gorilla/websocket v1.4.0 // indirect
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/gorilla/websocket v1.4.1 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/jpillora/ansi v0.0.0-20170202005112-f496b27cd669 // indirect
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7
github.com/jpillora/cookieauth v0.0.0-20181130112401-3b2db39b9d2c
github.com/jpillora/cookieauth v0.0.0-20190219222732-2ae29b2a9c76
github.com/jpillora/eventsource v0.0.0-20170920003432-7ed8c999e167 // indirect
github.com/jpillora/ipfilter v0.0.0-20180911073613-0cbe4c7e01b1
github.com/jpillora/opts v1.1.0
github.com/jpillora/ipfilter v1.0.0
github.com/jpillora/opts v1.1.2
github.com/jpillora/requestlog v0.0.0-20181015073026-df8817be5f82
github.com/jpillora/sizestr v0.0.0-20160130011556-e2ea2fa42fb9 // indirect
github.com/jpillora/velox v0.0.0-20180825063758-42845d323220
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/naoina/toml v0.1.1
github.com/oschwald/maxminddb-golang v1.3.0 // indirect
github.com/rakyll/statik v0.1.5
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 // indirect
golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6 // indirect
github.com/rakyll/statik v0.1.6
golang.org/x/crypto v0.0.0-20190907121410-71b5226ff739 // indirect
)
58 changes: 32 additions & 26 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,56 +1,62 @@
github.com/NYTimes/gziphandler v1.0.1 h1:iLrQrdwjDd52kHDA5op2UBJFjmOb9g+7scBan4RN8F0=
github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 h1:axBiC50cNZOs7ygH5BgQp4N+aYrZ2DNpWZ1KG3VOSOM=
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2/go.mod h1:jnzFpU88PccN/tPPhCpnNU8mZphvKxYM9lLNkd8e+os=
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/elithrar/simple-scrypt v1.3.0 h1:KIlOlxdoQf9JWKl5lMAJ28SY2URB0XTRDn2TckyzAZg=
github.com/elithrar/simple-scrypt v1.3.0/go.mod h1:U2XQRI95XHY0St410VE3UjT7vuKb1qPwrl/EJwEqnZo=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk=
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/jpillora/ansi v0.0.0-20170202005112-f496b27cd669 h1:l5rH/CnVVu+HPxjtxjM90nHrm4nov3j3RF9/62UjgLs=
github.com/jpillora/ansi v0.0.0-20170202005112-f496b27cd669/go.mod h1:kOeLNvjNBGSV3uYtFjvb72+fnZCMFJF1XDvRIjdom0g=
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7 h1:K//n/AqR5HjG3qxbrBCL4vJPW0MVFSs9CPK1OOJdRME=
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=
github.com/jpillora/cookieauth v0.0.0-20181130112401-3b2db39b9d2c h1:qXvc7fCjjO0t9XN5XShVGUIvQdmGXAvBHS2GKWGBtq0=
github.com/jpillora/cookieauth v0.0.0-20181130112401-3b2db39b9d2c/go.mod h1:gkgTOYcLwFR4iNKNBdlyiSJ3WNQjJ1k0Yo8z5GQf8bc=
github.com/jpillora/cookieauth v0.0.0-20190219222732-2ae29b2a9c76 h1:hbobq7RpymJc0jDg6lqo/sulXVGTCEmD67j6nwQ9BhQ=
github.com/jpillora/cookieauth v0.0.0-20190219222732-2ae29b2a9c76/go.mod h1:gkgTOYcLwFR4iNKNBdlyiSJ3WNQjJ1k0Yo8z5GQf8bc=
github.com/jpillora/eventsource v0.0.0-20170920003432-7ed8c999e167 h1:e+b0kVgqckdJnfgmJM8vqG6PnyRbdhI26tVfCNf3kMw=
github.com/jpillora/eventsource v0.0.0-20170920003432-7ed8c999e167/go.mod h1:qaSVvI/JUZarbxO3OwihjLyh9SO49T1cGjUeyIheDAs=
github.com/jpillora/ipfilter v0.0.0-20180911073613-0cbe4c7e01b1 h1:uVa/fnx/kuryYhFc6nC9VGWTausRXKSsWwo5C11kS1I=
github.com/jpillora/ipfilter v0.0.0-20180911073613-0cbe4c7e01b1/go.mod h1:cVpzWD9ypibSo5IdbBqJf9dVKW/pPeLGx0q+4X7k5rk=
github.com/jpillora/opts v0.0.0-20160806153215-3f7962811f23 h1:Oba9AG0bpHgp5FZFG+XfiNDlFX6tLO0AWCMe/YJR0GM=
github.com/jpillora/opts v0.0.0-20160806153215-3f7962811f23/go.mod h1:8/sC6XyMKHq/ybiU9Oqc1i0tDjFA/6otW7+Ha/qtnfo=
github.com/jpillora/opts v1.1.0 h1:eP4c8yn68iN4OgQ/6nTAWd+obufJOwUvAqW7dYzvCwA=
github.com/jpillora/opts v1.1.0/go.mod h1:7p7X/vlpKZmtaDFYKs956EujFqA6aCrOkcCaS6UBcR4=
github.com/jpillora/ipfilter v1.0.0 h1:iOdQcx4MEesxmU9IjOZ/yPlXAHpvX/NgG9QUNr8TOpc=
github.com/jpillora/ipfilter v1.0.0/go.mod h1:wuysWh3ibOyGQXDBthc4PMZKTKa/8s4RbaOtkTKOOhs=
github.com/jpillora/opts v1.1.2 h1:54/W0/fvo1DexHbL2utsW4rDhr5RXgojsPD2TA5oEzI=
github.com/jpillora/opts v1.1.2/go.mod h1:7p7X/vlpKZmtaDFYKs956EujFqA6aCrOkcCaS6UBcR4=
github.com/jpillora/requestlog v0.0.0-20181015073026-df8817be5f82 h1:7ufdyC3aMxFcCv+ABZy/dmIVGKFoGNBCqOgLYPIckD8=
github.com/jpillora/requestlog v0.0.0-20181015073026-df8817be5f82/go.mod h1:w8buj+yNfmLEP0ENlbG/FRnK6bVmuhqXnukYCs9sDvY=
github.com/jpillora/sizestr v0.0.0-20160130011556-e2ea2fa42fb9 h1:0c9jcgBtHRtDU//jTrcCgWG6UHjMZytiq/3WhraNgUM=
github.com/jpillora/sizestr v0.0.0-20160130011556-e2ea2fa42fb9/go.mod h1:1ffp+CRe0eAwwRb0/BownUAjMBsmTLwgAvRbfj9dRwE=
github.com/jpillora/velox v0.0.0-20180825063758-42845d323220 h1:/Vd3hZfOq+NZuY9OQ2pQ/dN8O1J2Kx4x77jmCIxpAQk=
github.com/jpillora/velox v0.0.0-20180825063758-42845d323220/go.mod h1:ql/Vc4cQrLfCUIccPRpchZMhTcbnXBXUAvMglI6z3yQ=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a h1:+J2gw7Bw77w/fbK7wnNJJDKmw1IbWft2Ul5BzrG1Qm8=
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a/go.mod h1:M1qoD/MqPgTZIk0EWKB38wE28ACRfVcn+cU08jyArI0=
github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks=
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
github.com/naoina/toml v0.1.1 h1:PT/lllxVVN0gzzSqSlHEmP8MJB4MY2U7STGxiouV4X8=
github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/oschwald/maxminddb-golang v1.3.0 h1:oTh8IBSj10S5JNlUDg5WjJ1QdBMdeaZIkPEVfESSWgE=
github.com/oschwald/maxminddb-golang v1.3.0/go.mod h1:3jhIUymTJ5VREKyIhWm66LJiQt04F0UCDdodShpjWsY=
github.com/oschwald/maxminddb-golang v1.4.0 h1:5/rpmW41qrgSed4wK32rdznbkTSXHcraY2LOMJX4DMc=
github.com/oschwald/maxminddb-golang v1.4.0/go.mod h1:3jhIUymTJ5VREKyIhWm66LJiQt04F0UCDdodShpjWsY=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.2.2-0.20190308074557-af07aa5181b3 h1:GqpA1/5oN1NgsxoSA4RH0YWTaqvUlQNeOpHXD/JRbOQ=
github.com/posener/complete v1.2.2-0.20190308074557-af07aa5181b3/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E=
github.com/rakyll/statik v0.1.5 h1:Ly2UjURzxnsSYS0zI50fZ+srA+Fu7EbpV5hglvJvJG0=
github.com/rakyll/statik v0.1.5/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs=
github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs=
github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce h1:fb190+cK2Xz/dvi9Hv8eCYJYvIGUTN2/KLq1pT6CjEc=
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6 h1:IcgEB62HYgAhX0Nd/QrVgZlxlcyxbGQHElLUhW2X4Fo=
golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190907121410-71b5226ff739 h1:Gc7JIyxvWgD6m+QmVryY0MstDORNYididDGxgZ6Tnpk=
golang.org/x/crypto v0.0.0-20190907121410-71b5226ff739/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190907184412-d223b2b6db03 h1:b3JiLYVaG9kHjTcOQIoUh978YMCO7oVTQQBLudU47zY=
golang.org/x/sys v0.0.0-20190907184412-d223b2b6db03/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"github.com/jpillora/webproc/agent"
)

var VERSION = "0.0.0-src"
var version = "0.0.0-src"

func main() {
//prepare config!
c := agent.Config{}
//parse cli
opts.New(&c).PkgRepo().Version(VERSION).Parse()
opts.New(&c).Name("webproc").PkgRepo().Version(version).Parse()
//if args contains has one non-executable file, treat as webproc file
//TODO: allow cli to override config file
args := c.ProgramArgs
Expand All @@ -32,7 +32,7 @@ func main() {
log.Fatalf("[webproc] load config error: %s", err)
}
//server listener
if err := agent.Run(VERSION, c); err != nil {
if err := agent.Run(version, c); err != nil {
log.Fatalf("[webproc] agent error: %s", err)
}
}

0 comments on commit b26a1a6

Please sign in to comment.