feat: support load env variables from .env file

This commit is contained in:
JustSong
2024-06-23 15:37:11 +08:00
parent 114c44c6e7
commit 254b9777c0
6 changed files with 11 additions and 50 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
_ "github.com/joho/godotenv/autoload"
"github.com/songquanpeng/one-api/common"
"github.com/songquanpeng/one-api/common/client"
"github.com/songquanpeng/one-api/common/config"
@@ -114,6 +115,7 @@ func main() {
if port == "" {
port = strconv.Itoa(*common.Port)
}
logger.SysLogf("server started on http://localhost:%s", port)
err = server.Run(":" + port)
if err != nil {
logger.FatalLog("failed to start HTTP server: " + err.Error())