refactor: move GetServerHost to bizpkg/env package (#2258)

This commit is contained in:
Ryo
2025-09-24 17:03:40 +08:00
committed by GitHub
parent 7335c153fa
commit 1e03691d36
3 changed files with 5 additions and 7 deletions

View File

@ -26,7 +26,7 @@ import (
"github.com/coze-dev/coze-studio/backend/application/plugin"
"github.com/coze-dev/coze-studio/backend/application/singleagent"
"github.com/coze-dev/coze-studio/backend/application/upload"
"github.com/coze-dev/coze-studio/backend/domain/plugin/conf"
"github.com/coze-dev/coze-studio/backend/bizpkg/env"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
@ -60,11 +60,9 @@ func OauthAuthorizationCode(ctx context.Context, c *app.RequestContext) {
return
}
redirectURL := fmt.Sprintf("%s/information/auth/success", conf.GetServerHost())
redirectURL := fmt.Sprintf("%s/information/auth/success", env.GetServerHost())
c.Redirect(consts.StatusFound, []byte(redirectURL))
c.Abort()
return
}
// UploadFileOpen .

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package conf
package env
import (
"os"

View File

@ -28,9 +28,9 @@ import (
"golang.org/x/oauth2"
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
"github.com/coze-dev/coze-studio/backend/bizpkg/env"
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/consts"
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/model"
"github.com/coze-dev/coze-studio/backend/domain/plugin/conf"
"github.com/coze-dev/coze-studio/backend/domain/plugin/dto"
"github.com/coze-dev/coze-studio/backend/domain/plugin/encrypt"
"github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
@ -475,7 +475,7 @@ func getStanderOAuthConfig(config *model.OAuthAuthorizationCodeConfig) *oauth2.C
TokenURL: config.AuthorizationURL,
AuthURL: config.ClientURL,
},
RedirectURL: fmt.Sprintf("%s/api/oauth/authorization_code", conf.GetServerHost()),
RedirectURL: fmt.Sprintf("%s/api/oauth/authorization_code", env.GetServerHost()),
Scopes: strings.Split(config.Scope, " "),
}
}