fix: persist host port and compat mode in config.toml

The host-side port mapping and seccomp compatibility-mode selections
were only used in-memory for docker run args and never written to
config.toml, so a re-run of the installer couldn't recover them as
form defaults (worse, the host port field silently defaulted to the
container's internal port). Add host_port and seccomp_unconfined to
[server] and decode them back via AppConfig.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-26 15:08:24 -03:00
co-authored by Claude Sonnet 5
parent a05b98fdf5
commit 2fecad021b
3 changed files with 26 additions and 9 deletions
+14 -6
View File
@@ -61,9 +61,11 @@ type ConfigValues struct {
type AppConfig struct {
Server struct {
Port int64 `toml:"port"`
Timeout int64 `toml:"timeout_seconds"`
Environment string `toml:"environment"`
Port int64 `toml:"port"`
HostPort int64 `toml:"host_port"`
Timeout int64 `toml:"timeout_seconds"`
Environment string `toml:"environment"`
SeccompUnconfined bool `toml:"seccomp_unconfined"`
} `toml:"server"`
Database struct {
Type string `toml:"type"`
@@ -83,7 +85,8 @@ type AppConfig struct {
func loadConfig() AppConfig {
var config AppConfig
config.Server.Port = 8081
config.Server.Port = containerAppPort
config.Server.HostPort = 8081
config.Server.Timeout = 30
config.Server.Environment = "production"
@@ -113,6 +116,11 @@ func InitialModel() Model {
s.Spinner = spinner.Dot
s.Style = SpinnerStyle
seccompDefault := "Não"
if cfg.Server.SeccompUnconfined {
seccompDefault = "Sim"
}
return Model{
currentStep: StepCheckDocker,
loginForm: NewFormStep("Login no Repositório Docker", []FormField{
@@ -175,7 +183,7 @@ func InitialModel() Model {
Id: "port",
Label: "Porta (host)",
Placeholder: "8081",
Default: strconv.FormatInt(cfg.Server.Port, 10),
Default: strconv.FormatInt(cfg.Server.HostPort, 10),
Type: FieldTypeNumber,
CharLimit: 4,
},
@@ -197,7 +205,7 @@ func InitialModel() Model {
{
Id: "seccomp_unconfined",
Label: "Modo Compatibilidade (máquinas antigas)",
Default: "Não",
Default: seccompDefault,
Type: FieldTypeSelect,
Options: []string{"Não", "Sim"},
},