2020-07-16 10:51:50 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
|
2020-07-16 11:25:13 +02:00
|
|
|
"forge.cadoles.com/mlamalle/go-jwtserver/internal/router"
|
2020-07-16 10:51:50 +02:00
|
|
|
"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)
|
|
|
|
}
|
2020-07-22 10:14:13 +02:00
|
|
|
confWebadress = os.Getenv("jwt_web_adress")
|
2020-07-16 10:51:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
}
|