Skip to content

Commit

Permalink
Remove old config options
Browse files Browse the repository at this point in the history
  • Loading branch information
quexten committed Feb 9, 2024
1 parent 35cc409 commit 69797aa
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 60 deletions.
2 changes: 1 addition & 1 deletion agent/actions/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func handleLogin(msg messages.IPCMessage, cfg *config.Config, vault *vault.Vault, callingContext *sockets.CallingContext) (response messages.IPCMessage, err error) {
if !cfg.HasPin() && !cfg.ConfigFile.RuntimeConfig.DisablePinRequirement {
if !cfg.HasPin() {
response, err = messages.IPCMessageFromPayload(messages.ActionResponse{
Success: false,
Message: "No pin set. Set a pin first!",
Expand Down
32 changes: 13 additions & 19 deletions agent/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,19 @@ const (
)

type RuntimeConfig struct {
DisableAuth bool
DisablePinRequirement bool
AuthMethod string
DoNotPersistConfig bool
ConfigDirectory string
DisableSSHAgent bool
WebsocketDisabled bool
ApiURI string
IdentityURI string
NotificationsURI string
SingleProcess bool
DeviceUUID string
User string
Password string
Pin string
UseMemguard bool
SSHAgentSocketPath string
GoldwardenSocketPath string
DaemonAuthToken string
AuthMethod string
DoNotPersistConfig bool
ConfigDirectory string
DisableSSHAgent bool
WebsocketDisabled bool
DeviceUUID string
User string
Password string
Pin string
UseMemguard bool
SSHAgentSocketPath string
GoldwardenSocketPath string
DaemonAuthToken string
}

type ConfigFile struct {
Expand Down
9 changes: 0 additions & 9 deletions agent/unixsocketagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,6 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
cfg.WriteConfig()
}
cfg.ConfigFile.RuntimeConfig = runtimeConfig
if cfg.ConfigFile.RuntimeConfig.ApiURI != "" {
cfg.ConfigFile.ApiUrl = cfg.ConfigFile.RuntimeConfig.ApiURI
}
if cfg.ConfigFile.RuntimeConfig.IdentityURI != "" {
cfg.ConfigFile.IdentityUrl = cfg.ConfigFile.RuntimeConfig.IdentityURI
}
if cfg.ConfigFile.RuntimeConfig.NotificationsURI != "" {
cfg.ConfigFile.NotificationsUrl = cfg.ConfigFile.RuntimeConfig.NotificationsURI
}
if cfg.ConfigFile.RuntimeConfig.DeviceUUID != "" {
cfg.ConfigFile.DeviceUUID = cfg.ConfigFile.RuntimeConfig.DeviceUUID
}
Expand Down
2 changes: 1 addition & 1 deletion client/setup/setup_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func VerifySetup(runtimeConfig config.RuntimeConfig) bool {
if !cmd.IsPolkitSetup() && !runtimeConfig.DisableAuth {
if !cmd.IsPolkitSetup() {
fmt.Println("Polkit is not setup. Run 'goldwarden setup polkit' to set it up.")
return false
}
Expand Down
42 changes: 12 additions & 30 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,18 @@ func main() {
configPath = strings.ReplaceAll(configPath, "~", userHome)

runtimeConfig := config.RuntimeConfig{
WebsocketDisabled: os.Getenv("GOLDWARDEN_WEBSOCKET_DISABLED") == "true",
DisableSSHAgent: os.Getenv("GOLDWARDEN_SSH_AGENT_DISABLED") == "true",
DisableAuth: os.Getenv("GOLDWARDEN_SYSTEM_AUTH_DISABLED") == "true",
DisablePinRequirement: os.Getenv("GOLDWARDEN_PIN_REQUIREMENT_DISABLED") == "true",
DoNotPersistConfig: os.Getenv("GOLDWARDEN_DO_NOT_PERSIST_CONFIG") == "true",
ApiURI: os.Getenv("GOLDWARDEN_API_URI"),
IdentityURI: os.Getenv("GOLDWARDEN_IDENTITY_URI"),
SingleProcess: os.Getenv("GOLDWARDEN_SINGLE_PROCESS") == "true",
DeviceUUID: os.Getenv("GOLDWARDEN_DEVICE_UUID"),
AuthMethod: os.Getenv("GOLDWARDEN_AUTH_METHOD"),
User: os.Getenv("GOLDWARDEN_AUTH_USER"),
Password: os.Getenv("GOLDWARDEN_AUTH_PASSWORD"),
Pin: os.Getenv("GOLDWARDEN_PIN"),
UseMemguard: os.Getenv("GOLDWARDEN_NO_MEMGUARD") != "true",
SSHAgentSocketPath: os.Getenv("GOLDWARDEN_SSH_AUTH_SOCK"),
GoldwardenSocketPath: os.Getenv("GOLDWARDEN_SOCKET_PATH"),
DaemonAuthToken: os.Getenv("GOLDWARDEN_DAEMON_AUTH_TOKEN"),
WebsocketDisabled: os.Getenv("GOLDWARDEN_WEBSOCKET_DISABLED") == "true",
DisableSSHAgent: os.Getenv("GOLDWARDEN_SSH_AGENT_DISABLED") == "true",
DoNotPersistConfig: os.Getenv("GOLDWARDEN_DO_NOT_PERSIST_CONFIG") == "true",
DeviceUUID: os.Getenv("GOLDWARDEN_DEVICE_UUID"),
AuthMethod: os.Getenv("GOLDWARDEN_AUTH_METHOD"),
User: os.Getenv("GOLDWARDEN_AUTH_USER"),
Password: os.Getenv("GOLDWARDEN_AUTH_PASSWORD"),
Pin: os.Getenv("GOLDWARDEN_PIN"),
UseMemguard: os.Getenv("GOLDWARDEN_NO_MEMGUARD") != "true",
SSHAgentSocketPath: os.Getenv("GOLDWARDEN_SSH_AUTH_SOCK"),
GoldwardenSocketPath: os.Getenv("GOLDWARDEN_SOCKET_PATH"),
DaemonAuthToken: os.Getenv("GOLDWARDEN_DAEMON_AUTH_TOKEN"),

ConfigDirectory: configPath,
}
Expand Down Expand Up @@ -67,18 +62,5 @@ func main() {
runtimeConfig.GoldwardenSocketPath = userHome + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}

if runtimeConfig.SingleProcess {
runtimeConfig.DisablePinRequirement = true
runtimeConfig.DisableAuth = true
}

if runtimeConfig.DisablePinRequirement {
runtimeConfig.DoNotPersistConfig = true
}

if runtimeConfig.DisableAuth {
os.Setenv("GOLDWARDEN_SYSTEM_AUTH_DISABLED", "true")
}

cmd.Execute(runtimeConfig)
}

0 comments on commit 69797aa

Please sign in to comment.