feat: Add flag for bind host
This commit is contained in:
parent
9f6190a762
commit
3213366262
1 changed files with 2 additions and 1 deletions
3
main.go
3
main.go
|
@ -29,6 +29,7 @@ func RandString(n int) string {
|
||||||
|
|
||||||
var dataDirFlag = flag.String("dataDir", "/tmp", "directory for files")
|
var dataDirFlag = flag.String("dataDir", "/tmp", "directory for files")
|
||||||
var domainFlag = flag.String("domain", "http://localhost:8085", "base domain")
|
var domainFlag = flag.String("domain", "http://localhost:8085", "base domain")
|
||||||
|
var bindFlag = flag.String("bind", ":8085", "host and port to bind")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
h := &Handler{
|
h := &Handler{
|
||||||
|
@ -36,7 +37,7 @@ func main() {
|
||||||
Domain: *domainFlag,
|
Domain: *domainFlag,
|
||||||
}
|
}
|
||||||
log.Println("listening")
|
log.Println("listening")
|
||||||
panic(http.ListenAndServe(":8085", h))
|
panic(http.ListenAndServe(*bindFlag, h))
|
||||||
}
|
}
|
||||||
|
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
|
|
Loading…
Reference in a new issue