27 lines
394 B
Go
27 lines
394 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"local/args"
|
|
)
|
|
|
|
var (
|
|
Port string
|
|
Public string
|
|
)
|
|
|
|
func init() {
|
|
New()
|
|
}
|
|
|
|
func New() {
|
|
as := args.NewArgSet()
|
|
as.Append(args.INT, "p", "port to listen on", 52222)
|
|
as.Append(args.STRING, "d", "dir with public files", "./public")
|
|
if err := as.Parse(); err != nil {
|
|
panic(err)
|
|
}
|
|
Port = fmt.Sprintf(":%d", as.GetInt("p"))
|
|
Public = as.GetString("d")
|
|
}
|