增加支付逻辑
This commit is contained in:
1 parent
4ac786aafb
commit
dfb2c91b8d
77 files changed
+6370
-45
No files matched your search
@@ -14,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.nianxx.cn/wangxuming/NianAIGC/backend/internal/application"
|
||||
"git.nianxx.cn/wangxuming/NianAIGC/backend/internal/migrations"
|
||||
"git.nianxx.cn/wangxuming/NianAIGC/backend/internal/settings"
|
||||
)
|
||||
|
||||
@@ -33,9 +34,9 @@ func run() error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("load Go backend runtime settings: %w", err)
|
||||
}
|
||||
app, err := application.New(application.Options{Context: ctx, Getenv: getenv})
|
||||
app, err := initializeApplication(ctx, getenv)
|
||||
if err != nil {
|
||||
return fmt.Errorf("initialize Go backend: %w", err)
|
||||
return err
|
||||
}
|
||||
defer app.Close()
|
||||
|
||||
@@ -71,6 +72,19 @@ func run() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Complete schema updates before constructing services, bootstrapping accounts,
|
||||
// starting background workers, or opening the HTTP listener.
|
||||
func initializeApplication(ctx context.Context, getenv func(string) string) (*application.App, error) {
|
||||
if err := migrations.Run(ctx, getenv); err != nil {
|
||||
return nil, fmt.Errorf("migrate database before startup: %w", err)
|
||||
}
|
||||
app, err := application.New(application.Options{Context: ctx, Getenv: getenv})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("initialize Go backend: %w", err)
|
||||
}
|
||||
return app, nil
|
||||
}
|
||||
|
||||
func runtimeGetenv(process func(string) string) (func(string) string, error) {
|
||||
path := strings.TrimSpace(process("ZHINIAN_SETTINGS_FILE"))
|
||||
if path == "" {
|
||||
|
||||
Reference in new issue
Block a user