1
0
This commit is contained in:
Antonio 2023-04-29 20:17:15 +08:00
commit 959af67acb

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"freechatgpt/internal/tokens"
"os"
"strings"
"github.com/fvbock/endless"
"github.com/gin-gonic/gin"
@ -24,6 +25,11 @@ func init() {
if PORT == "" {
PORT = "8080"
}
accessToken := os.Getenv("ACCESS_TOKENS")
if accessToken != "" {
accessTokens := strings.Split(accessToken, ",")
ACCESS_TOKENS = tokens.NewAccessToken(accessTokens)
}
// Check if access_tokens.json exists
if _, err := os.Stat("access_tokens.json"); os.IsNotExist(err) {
// Create the file