Browse Source

Support configuring via .env file

master
Matt Baer 2 years ago
parent
commit
b3834b1af9
4 changed files with 16 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +12
    -0
      cmd/htmlhouse/main.go
  3. +1
    -0
      go.mod
  4. +2
    -0
      go.sum

+ 1
- 0
.gitignore View File

@@ -1,4 +1,5 @@
node_modules/
build/
.env
*~
*.swp

+ 12
- 0
cmd/htmlhouse/main.go View File

@@ -1,9 +1,21 @@
package main

import (
"fmt"
"github.com/joho/godotenv"
"github.com/writeas/htmlhouse"
"os"
)

func main() {
source := os.Getenv("CONFIG_SOURCE")
if source == "" {
source = ".env"
}
err := godotenv.Load(source)
if err != nil {
fmt.Println("unable to load configuration file", source, ":", err)
}

htmlhouse.Serve()
}

+ 1
- 0
go.mod View File

@@ -14,6 +14,7 @@ require (
github.com/garyburd/go-oauth v0.0.0-20180319155456-bca2e7f09a17 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/gorilla/mux v1.8.0
github.com/joho/godotenv v1.3.0
github.com/juju/errgo v0.0.0-20140925100237-08cceb5d0b53
github.com/writeas/impart v1.1.1
github.com/writeas/nerds v1.0.0


+ 2
- 0
go.sum View File

@@ -21,6 +21,8 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/juju/errgo v0.0.0-20140925100237-08cceb5d0b53 h1:tGpfbOOO0SV3qtMUx8O9RbJeei6VDBwnpQQ0JYIFaVg=
github.com/juju/errgo v0.0.0-20140925100237-08cceb5d0b53/go.mod h1:ZtgUe3RyZisw/AlQjgU9DeO3hqUH9E/bkreI2FLg/QY=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=


Loading…
Cancel
Save