40 lines
696 B
Go
40 lines
696 B
Go
|
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))
|
||
|
|
||
|
}
|