Skip to content

Commit

Permalink
Add env Support
Browse files Browse the repository at this point in the history
  • Loading branch information
steveyiyo committed Feb 7, 2021
1 parent d62be5e commit 217a68a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"log"
"math/rand"
"net/http"
"os"
"strings"
"time"

"github.com/joho/godotenv"
_ "github.com/mattn/go-sqlite3"
)

Expand Down Expand Up @@ -50,7 +52,12 @@ func webServer(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")

if r.URL.Path == "/api/create" {
tokenValue := "123456"
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}

tokenValue := os.Getenv("token")

r.ParseForm()
token := "NULL"
Expand Down

0 comments on commit 217a68a

Please sign in to comment.