Compare commits
2 Commits
dd736bc927
...
18841ea58a
| Author | SHA1 | Date |
|---|---|---|
|
|
18841ea58a | |
|
|
1fbc81f88c |
|
|
@ -13,6 +13,5 @@ COPY --from=build /app/web /app/web
|
||||||
COPY --from=build /app/server/config.test.yaml /app/server/config.test.yaml
|
COPY --from=build /app/server/config.test.yaml /app/server/config.test.yaml
|
||||||
COPY --from=build /app/server/config.prod.yaml /app/server/config.prod.yaml
|
COPY --from=build /app/server/config.prod.yaml /app/server/config.prod.yaml
|
||||||
RUN mkdir -p /app/storage/export
|
RUN mkdir -p /app/storage/export
|
||||||
ENV APP_ENV=prod
|
|
||||||
EXPOSE 8077
|
EXPOSE 8077
|
||||||
ENTRYPOINT ["/app/bin/marketing-data-server"]
|
ENTRYPOINT ["/app/bin/marketing-data-server"]
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"marketing-system-data-tool/server/internal/api"
|
"marketing-system-data-tool/server/internal/api"
|
||||||
"marketing-system-data-tool/server/internal/config"
|
"marketing-system-data-tool/server/internal/config"
|
||||||
"marketing-system-data-tool/server/internal/db"
|
"marketing-system-data-tool/server/internal/db"
|
||||||
"marketing-system-data-tool/server/internal/migrate"
|
|
||||||
"marketing-system-data-tool/server/internal/logging"
|
"marketing-system-data-tool/server/internal/logging"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -14,6 +13,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cfg := config.Load()
|
cfg := config.Load()
|
||||||
|
log.Println("APP_ENV:", os.Getenv("APP_ENV"))
|
||||||
if cfg.YMTKeyDecryptKeyB64 != "" { os.Setenv("YMT_KEY_DECRYPT_KEY_B64", cfg.YMTKeyDecryptKeyB64) }
|
if cfg.YMTKeyDecryptKeyB64 != "" { os.Setenv("YMT_KEY_DECRYPT_KEY_B64", cfg.YMTKeyDecryptKeyB64) }
|
||||||
_ = logging.Init("log")
|
_ = logging.Init("log")
|
||||||
log.Println("connecting YMT MySQL:", cfg.YMTDB.Host+":"+cfg.YMTDB.Port, "db", cfg.YMTDB.Name, "user", cfg.YMTDB.User)
|
log.Println("connecting YMT MySQL:", cfg.YMTDB.Host+":"+cfg.YMTDB.Port, "db", cfg.YMTDB.Name, "user", cfg.YMTDB.User)
|
||||||
|
|
@ -32,14 +32,8 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if cfg.YMTDB.DSN() != "" {
|
_ = ymt
|
||||||
if err := migrate.Apply(ymt); err != nil {
|
r := api.NewRouter(ymt, marketing)
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Println("skip migrations: YMT DSN missing")
|
|
||||||
}
|
|
||||||
r := api.NewRouter(ymt, marketing)
|
|
||||||
addr := ":" + func() string {
|
addr := ":" + func() string {
|
||||||
s := cfg.Port
|
s := cfg.Port
|
||||||
if s == "" {
|
if s == "" {
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,8 @@ func ExportsHandler(meta, marketing *sql.DB) http.Handler {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ExportsAPI) ensureOwnerColumn() {
|
// owner_id 列在只读库不做运行时变更,避免 ALTER TABLE 触发错误
|
||||||
// Try to add owner_id column if not exists; ignore errors
|
func (a *ExportsAPI) ensureOwnerColumn() {}
|
||||||
_, _ = a.meta.Exec("ALTER TABLE export_jobs ADD COLUMN owner_id BIGINT UNSIGNED NOT NULL DEFAULT 0")
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExportPayload struct {
|
type ExportPayload struct {
|
||||||
TemplateID uint64 `json:"template_id"`
|
TemplateID uint64 `json:"template_id"`
|
||||||
|
|
@ -947,7 +945,6 @@ func toString(v interface{}) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (a *ExportsAPI) list(w http.ResponseWriter, r *http.Request) {
|
func (a *ExportsAPI) list(w http.ResponseWriter, r *http.Request) {
|
||||||
a.ensureOwnerColumn()
|
|
||||||
q := r.URL.Query()
|
q := r.URL.Query()
|
||||||
page := 1
|
page := 1
|
||||||
size := 15
|
size := 15
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue