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:
+14
-6
@@ -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"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user