aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/config.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-12-08 02:53:07 +0900
committerOphestra <cat@gensokyo.uk>2025-12-08 03:13:02 +0900
commit422efcf258eb49ecd0d4de8e53adae656696ea56 (patch)
tree5abcdd8a0636567939dd94a7a7d1cd5ba180176c /hst/config.go
parent104eeecf650ba52e155ff63a4d4456a6391e961f (diff)
hst: check for insecure PulseAudio enablement
This is currently still a noop, but required for #26. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/config.go')
-rw-r--r--hst/config.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/hst/config.go b/hst/config.go
index c6cd790c..23c21ccf 100644
--- a/hst/config.go
+++ b/hst/config.go
@@ -60,6 +60,9 @@ var (
// ErrEnviron is returned by [Config.Validate] if an environment variable name contains '=' or NUL.
ErrEnviron = errors.New("invalid environment variable name")
+
+ // ErrInsecure is returned by [Config.Validate] if the configuration is considered insecure.
+ ErrInsecure = errors.New("configuration is insecure")
)
// Validate checks [Config] and returns [AppError] if an invalid value is encountered.
@@ -106,6 +109,13 @@ func (config *Config) Validate() error {
}
}
+ // EPulse without EPipeWire is insecure
+ if et := config.Enablements.Unwrap(); !config.DirectPulse &&
+ et&EPipeWire == 0 && et&EPulse != 0 {
+ return &AppError{Step: "validate configuration", Err: ErrInsecure,
+ Msg: "enablement PulseAudio requires PipeWire, which is not set"}
+ }
+
return nil
}