internal/env: relocate from app

This package is much cleaner to stub independently, and makes no sense to lump into app.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-10-29 04:09:42 +09:00
parent 274686d10d
commit a52f7038e5
9 changed files with 108 additions and 114 deletions

View File

@@ -8,6 +8,7 @@ import (
"hakurei.app/container"
"hakurei.app/container/check"
"hakurei.app/hst"
"hakurei.app/internal/env"
"hakurei.app/message"
"hakurei.app/system"
"hakurei.app/system/acl"
@@ -58,7 +59,7 @@ type outcomeState struct {
// Copied from [EnvPaths] per-process.
sc hst.Paths
*EnvPaths
*env.Paths
// Copied via populateLocal.
k syscallDispatcher
@@ -72,7 +73,7 @@ func (s *outcomeState) valid() bool {
s.Shim.valid() &&
s.ID != nil &&
s.Container != nil &&
s.EnvPaths != nil
s.Paths != nil
}
// newOutcomeState returns the address of a new outcomeState with its exported fields populated via syscallDispatcher.
@@ -82,7 +83,7 @@ func newOutcomeState(k syscallDispatcher, msg message.Msg, id *hst.ID, config *h
ID: id,
Identity: config.Identity,
UserID: hsu.MustID(msg),
EnvPaths: copyPaths(k),
Paths: env.CopyPathsFunc(k.fatalf, k.tempdir, func(key string) string { v, _ := k.lookupEnv(key); return v }),
Container: config.Container,
}