go-jwtserver/cmd/jwtserver/main.go

40 lines
696 B
Go
Raw Normal View History

2020-07-16 10:51:50 +02:00
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"forges.cadoles.com/go-jwtserver/internal/router"
"github.com/joho/godotenv"
)
var (
configFile = ""
dumpConfig = false
version = false
confWebadress = ""
)
func init() {
e := godotenv.Load() //Load .env file
if e != nil {
fmt.Print(e)
}
confWebadress = os.Getenv("web_adress")
}
func main() {
flag.Parse()
router := router.InitializeRouter()
// Passing -routes to the program will generate docs for the above
// router definition. See the `routes.json` file in this folder for
// the output.
log.Printf("listening on '%s'", confWebadress)
log.Fatal(http.ListenAndServe(confWebadress, router))
}