diff options
| author | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 12:12:43 +0200 |
|---|---|---|
| committer | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 12:12:43 +0200 |
| commit | 4bf44b16562335b3d09b6df0150521bb5b5f776f (patch) | |
| tree | 576723e6dc9f9db48d0892f7ec354a11b973aef4 /cmd/port | |
| parent | Added 2 more glyphs (diff) | |
| download | gopherproxy-4bf44b16562335b3d09b6df0150521bb5b5f776f.tar.gz gopherproxy-4bf44b16562335b3d09b6df0150521bb5b5f776f.tar.bz2 gopherproxy-4bf44b16562335b3d09b6df0150521bb5b5f776f.zip | |
WIP: Refactoring
Diffstat (limited to 'cmd/port')
| -rw-r--r-- | cmd/port/main.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cmd/port/main.go b/cmd/port/main.go new file mode 100644 index 0000000..6cdccc6 --- /dev/null +++ b/cmd/port/main.go | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | package main | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "flag" | ||
| 5 | "log" | ||
| 6 | |||
| 7 | port "git.vulpes.one/Feuerfuchs/port/internal/port" | ||
| 8 | ) | ||
| 9 | |||
| 10 | var ( | ||
| 11 | // TODO: Allow config file and environment vars | ||
| 12 | // (opt -> env -> config -> default) | ||
| 13 | bind = flag.String("bind", "0.0.0.0:8000", "[int]:port to bind to") | ||
| 14 | startpagefile = flag.String("startpage-file", "startpage.txt", "Default page to display if no URL is specified") | ||
| 15 | robotsfile = flag.String("robots-file", "robots.txt", "robots.txt file") | ||
| 16 | robotsdebug = flag.Bool("robots-debug", false, "print output about ignored robots.txt") | ||
| 17 | vipsconcurrency = flag.Int("vips-concurrency", 1, "Concurrency level of libvips") | ||
| 18 | ) | ||
| 19 | |||
| 20 | func main() { | ||
| 21 | flag.Parse() | ||
| 22 | |||
| 23 | // Use a config struct | ||
| 24 | log.Fatal(port.ListenAndServe(*bind, *startpagefile, *robotsfile, *robotsdebug, *vipsconcurrency)) | ||
| 25 | } | ||
