flags.go 531 B

12345678910111213141516171819202122
  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. )
  15. func InitFlags() {
  16. flag.Parse()
  17. os.MkdirAll(*STORAGE, 0755)
  18. }