refactor: split backend into standalone server project
Remove embedded frontend and workflow editor assets, add standalone API deployment configuration, and retain the current backend service updates.
This commit is contained in:
@@ -42,8 +42,9 @@ type WxWorkNotifyConfig struct {
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
Port int `yaml:"port"`
|
||||
CORS CORSConfig `yaml:"cors"`
|
||||
Port int `yaml:"port"`
|
||||
FrontendURL string `yaml:"frontendUrl"`
|
||||
CORS CORSConfig `yaml:"cors"`
|
||||
}
|
||||
|
||||
func (s ServerConfig) Address() string {
|
||||
@@ -53,6 +54,13 @@ func (s ServerConfig) Address() string {
|
||||
return fmt.Sprintf(":%d", s.Port)
|
||||
}
|
||||
|
||||
func (s ServerConfig) FrontendBaseURL() string {
|
||||
if value := strings.TrimRight(strings.TrimSpace(s.FrontendURL), "/"); value != "" {
|
||||
return value
|
||||
}
|
||||
return "http://127.0.0.1:3000"
|
||||
}
|
||||
|
||||
type CORSConfig struct {
|
||||
// AllowedOrigins 是允许浏览器跨域访问的 Origin 白名单,必须包含协议和域名。
|
||||
// 留空表示不允许跨域请求;同源请求通常不会携带 Origin,不受影响。
|
||||
|
||||
Reference in New Issue
Block a user