flags.go 501 B

123456789101112131415161718192021
  1. package main
  2. import (
  3. "flag"
  4. "os"
  5. "path"
  6. )
  7. import "github.com/mitchellh/go-homedir"
  8. var (
  9. HOME_DIR, _ = homedir.Dir()
  10. HTTPS_ADDR = flag.String("https", ":443", "the https address to listen on")
  11. STORAGE = flag.String("storage", path.Join(HOME_DIR, ".httpsify/certs"), "the ssl certs storage directory")
  12. HOSTS_FILE = flag.String("hosts", path.Join(HOME_DIR, ".httpsify/hosts.json"), "the sites configurations filename")
  13. )
  14. func InitFlags() {
  15. flag.Parse()
  16. os.MkdirAll(*STORAGE, 0755)
  17. }