Removed some cruft
This commit is contained in:
parent
0069622991
commit
52802aff70
15
main.go
15
main.go
@ -4,26 +4,20 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
|
||||||
"github.com/namsral/flag"
|
"github.com/namsral/flag"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var cfg Config
|
||||||
db *bolt.DB
|
|
||||||
cfg Config
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
config string
|
config string
|
||||||
dbpath string
|
|
||||||
bind string
|
bind string
|
||||||
fqdn string
|
fqdn string
|
||||||
expiry time.Duration
|
expiry time.Duration
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.StringVar(&config, "config", "", "config file")
|
flag.StringVar(&config, "config", "", "config file")
|
||||||
flag.StringVar(&dbpath, "dbpth", "urls.db", "Database path")
|
|
||||||
flag.StringVar(&bind, "bind", "0.0.0.0:8000", "[int]:<port> to bind to")
|
flag.StringVar(&bind, "bind", "0.0.0.0:8000", "[int]:<port> to bind to")
|
||||||
flag.StringVar(&fqdn, "fqdn", "localhost", "FQDN for public access")
|
flag.StringVar(&fqdn, "fqdn", "localhost", "FQDN for public access")
|
||||||
flag.DurationVar(&expiry, "expiry", 5*time.Minute, "expiry time for pastes")
|
flag.DurationVar(&expiry, "expiry", 5*time.Minute, "expiry time for pastes")
|
||||||
@ -37,12 +31,5 @@ func main() {
|
|||||||
cfg.fqdn = fqdn
|
cfg.fqdn = fqdn
|
||||||
cfg.expiry = expiry
|
cfg.expiry = expiry
|
||||||
|
|
||||||
var err error
|
|
||||||
db, err = bolt.Open(dbpath, 0600, nil)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer db.Close()
|
|
||||||
|
|
||||||
NewServer(bind, cfg).ListenAndServe()
|
NewServer(bind, cfg).ListenAndServe()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user