feat: implement license platform business flows and delivery tooling
Some checks failed
Check / delivery-static (push) Has been cancelled
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled

Add admin and customer interfaces, orders, signed activation and leases, protected package delivery, keyring verification, migrations, security controls, tests and deployment documentation.

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
2026-10-09 15:33:22 +08:00
parent 3ab651d3a8
commit 54c318c615
142 changed files with 11105 additions and 178 deletions

View File

@@ -0,0 +1,54 @@
package main
import (
"errors"
"flag"
"fmt"
"license-platform/backend/internal/migrations"
"os"
)
func main() {
if err := run(os.Args[1:]); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func run(args []string) error {
flags := flag.NewFlagSet("migrate", flag.ContinueOnError)
dsn := flags.String("dsn", os.Getenv("MIGRATION_DSN"), "MySQL migrate URL, e.g. mysql://user:pass@tcp(host:3306)/db?multiStatements=true (also MIGRATION_DSN)")
directory := flags.String("dir", "./migrations", "migration directory")
forceVersion := flags.Int("version", -2, "version for force; required only with force")
if err := flags.Parse(args); err != nil {
return err
}
if flags.NArg() != 1 {
return errors.New("usage: migrate [-dsn DSN] [-dir DIR] up|down|version|force")
}
runner, err := migrations.Open(*dsn, *directory)
if err != nil {
return err
}
defer runner.Close()
switch flags.Arg(0) {
case "up":
return runner.Up()
case "down":
return runner.Down()
case "version":
version, dirty, err := runner.Version()
if err != nil {
return err
}
fmt.Printf("version=%d dirty=%t\n", version, dirty)
return nil
case "force":
if *forceVersion < -1 {
return errors.New("-version is required for force")
}
return runner.Force(*forceVersion)
default:
return fmt.Errorf("unknown action %q", flags.Arg(0))
}
}