From 5c4058d5ac7e7944973ca8216c258fc50c194e22 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 25 Mar 2025 01:52:49 +0900 Subject: app: run in native sandbox Signed-off-by: Ophestra --- internal/app/app.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'internal/app/app.go') diff --git a/internal/app/app.go b/internal/app/app.go index c4668a08..42d67b96 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -1,6 +1,7 @@ package app import ( + "context" "fmt" "log" "sync" @@ -10,9 +11,10 @@ import ( "git.gensokyo.uk/security/fortify/internal/sys" ) -func New(os sys.State) (fst.App, error) { +func New(ctx context.Context, os sys.State) (fst.App, error) { a := new(app) a.sys = os + a.ctx = ctx id := new(fst.ID) err := fst.NewAppID(id) @@ -21,8 +23,8 @@ func New(os sys.State) (fst.App, error) { return a, err } -func MustNew(os sys.State) fst.App { - a, err := New(os) +func MustNew(ctx context.Context, os sys.State) fst.App { + a, err := New(ctx, os) if err != nil { log.Fatalf("cannot create app: %v", err) } @@ -32,6 +34,7 @@ func MustNew(os sys.State) fst.App { type app struct { id *stringPair[fst.ID] sys sys.State + ctx context.Context *outcome mu sync.RWMutex @@ -71,7 +74,7 @@ func (a *app) Seal(config *fst.Config) (fst.SealedApp, error) { seal := new(outcome) seal.id = a.id - err := seal.finalise(a.sys, config) + err := seal.finalise(a.ctx, a.sys, config) if err == nil { a.outcome = seal } -- cgit v1.3.1