flags.go 756 B

123456789101112131415161718192021222324
  1. package main
  2. import (
  3. "flag"
  4. "os"
  5. "path"
  6. )
  7. import "github.com/mitchellh/go-homedir"
  8. var (
  9. VERSION = "httpsify/v3.0.0"
  10. HOME_DIR, _ = homedir.Dir()
  11. HTTPS_ADDR = flag.String("https", ":443", "the https address to listen on")
  12. STORAGE = flag.String("storage", path.Join(HOME_DIR, ".httpsify/certs"), "the ssl certs storage directory")
  13. HOSTS_FILE = flag.String("hosts", path.Join(HOME_DIR, ".httpsify/hosts.json"), "the sites configurations filename")
  14. HSTS = flag.String("hsts", "max-age=86400; includeSubDomains", "the hsts header value, empty value means disable")
  15. EXPOSE_INFO = flag.Bool("expose-info", true, "whether to expose the httpsify info header or not")
  16. )
  17. func InitFlags() {
  18. flag.Parse()
  19. os.MkdirAll(*STORAGE, 0755)
  20. }