Publish HTML quickly. https://html.house
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 regels
652 B

  1. package htmlhouse
  2. import (
  3. "github.com/danryan/env"
  4. )
  5. type config struct {
  6. StaticDir string `env:"key=STATIC_DIR default=static"`
  7. DBName string `env:"key=DB_DB required=true"`
  8. DBUser string `env:"key=DB_USER required=true"`
  9. DBPassword string `env:"key=DB_PASSWORD required=true"`
  10. DBHost string `env:"key=DB_HOST default=localhost"`
  11. PrivateKey string `env:"key=PRIVATE_KEY require=true"`
  12. PublicKey string `env:"key=PUBLIC_KEY require=true"`
  13. ServerPort int `env:"key=PORT default=8080"`
  14. }
  15. func newConfig() (*config, error) {
  16. cfg := &config{}
  17. if err := env.Process(cfg); err != nil {
  18. return cfg, err
  19. }
  20. return cfg, nil
  21. }