Skip to content

Commit 68777bf

Browse files
authored
Merge pull request #2237 from seefs001/feature/linux-do-settings
feat: support configuring the linuxdo endpoint via environment variables
2 parents 196fa13 + b6217b2 commit 68777bf

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
# 设置 Dify 渠道是否输出工作流和节点信息到客户端
6868
# DIFY_DEBUG=true
6969

70+
# LinuxDo相关配置
71+
LINUX_DO_TOKEN_ENDPOINT=https://connect.linux.do/oauth2/token
72+
LINUX_DO_USER_ENDPOINT=https://connect.linux.do/api/user
7073

7174
# 节点类型
7275
# 如果是主节点则为master

controller/linuxdo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func getLinuxdoUserInfoByCode(code string, c *gin.Context) (*LinuxdoUser, error)
8484
}
8585

8686
// Get access token using Basic auth
87-
tokenEndpoint := "https://connect.linux.do/oauth2/token"
87+
tokenEndpoint := common.GetEnvOrDefaultString("LINUX_DO_TOKEN_ENDPOINT", "https://connect.linux.do/oauth2/token")
8888
credentials := common.LinuxDOClientId + ":" + common.LinuxDOClientSecret
8989
basicAuth := "Basic " + base64.StdEncoding.EncodeToString([]byte(credentials))
9090

@@ -129,7 +129,7 @@ func getLinuxdoUserInfoByCode(code string, c *gin.Context) (*LinuxdoUser, error)
129129
}
130130

131131
// Get user info
132-
userEndpoint := "https://connect.linux.do/api/user"
132+
userEndpoint := common.GetEnvOrDefaultString("LINUX_DO_USER_ENDPOINT", "https://connect.linux.do/api/user")
133133
req, err = http.NewRequest("GET", userEndpoint, nil)
134134
if err != nil {
135135
return nil, err

0 commit comments

Comments
 (0)