Remove old config options
This commit is contained in:
parent
35cc409943
commit
69797aa50b
5 changed files with 27 additions and 60 deletions
|
|
@ -15,7 +15,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleLogin(msg messages.IPCMessage, cfg *config.Config, vault *vault.Vault, callingContext *sockets.CallingContext) (response messages.IPCMessage, err error) {
|
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{
|
response, err = messages.IPCMessageFromPayload(messages.ActionResponse{
|
||||||
Success: false,
|
Success: false,
|
||||||
Message: "No pin set. Set a pin first!",
|
Message: "No pin set. Set a pin first!",
|
||||||
|
|
|
||||||
|
|
@ -31,25 +31,19 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type RuntimeConfig struct {
|
type RuntimeConfig struct {
|
||||||
DisableAuth bool
|
AuthMethod string
|
||||||
DisablePinRequirement bool
|
DoNotPersistConfig bool
|
||||||
AuthMethod string
|
ConfigDirectory string
|
||||||
DoNotPersistConfig bool
|
DisableSSHAgent bool
|
||||||
ConfigDirectory string
|
WebsocketDisabled bool
|
||||||
DisableSSHAgent bool
|
DeviceUUID string
|
||||||
WebsocketDisabled bool
|
User string
|
||||||
ApiURI string
|
Password string
|
||||||
IdentityURI string
|
Pin string
|
||||||
NotificationsURI string
|
UseMemguard bool
|
||||||
SingleProcess bool
|
SSHAgentSocketPath string
|
||||||
DeviceUUID string
|
GoldwardenSocketPath string
|
||||||
User string
|
DaemonAuthToken string
|
||||||
Password string
|
|
||||||
Pin string
|
|
||||||
UseMemguard bool
|
|
||||||
SSHAgentSocketPath string
|
|
||||||
GoldwardenSocketPath string
|
|
||||||
DaemonAuthToken string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConfigFile struct {
|
type ConfigFile struct {
|
||||||
|
|
|
||||||
|
|
@ -316,15 +316,6 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
|
||||||
cfg.WriteConfig()
|
cfg.WriteConfig()
|
||||||
}
|
}
|
||||||
cfg.ConfigFile.RuntimeConfig = runtimeConfig
|
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 != "" {
|
if cfg.ConfigFile.RuntimeConfig.DeviceUUID != "" {
|
||||||
cfg.ConfigFile.DeviceUUID = cfg.ConfigFile.RuntimeConfig.DeviceUUID
|
cfg.ConfigFile.DeviceUUID = cfg.ConfigFile.RuntimeConfig.DeviceUUID
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func VerifySetup(runtimeConfig config.RuntimeConfig) bool {
|
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.")
|
fmt.Println("Polkit is not setup. Run 'goldwarden setup polkit' to set it up.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
main.go
42
main.go
|
|
@ -20,23 +20,18 @@ func main() {
|
||||||
configPath = strings.ReplaceAll(configPath, "~", userHome)
|
configPath = strings.ReplaceAll(configPath, "~", userHome)
|
||||||
|
|
||||||
runtimeConfig := config.RuntimeConfig{
|
runtimeConfig := config.RuntimeConfig{
|
||||||
WebsocketDisabled: os.Getenv("GOLDWARDEN_WEBSOCKET_DISABLED") == "true",
|
WebsocketDisabled: os.Getenv("GOLDWARDEN_WEBSOCKET_DISABLED") == "true",
|
||||||
DisableSSHAgent: os.Getenv("GOLDWARDEN_SSH_AGENT_DISABLED") == "true",
|
DisableSSHAgent: os.Getenv("GOLDWARDEN_SSH_AGENT_DISABLED") == "true",
|
||||||
DisableAuth: os.Getenv("GOLDWARDEN_SYSTEM_AUTH_DISABLED") == "true",
|
DoNotPersistConfig: os.Getenv("GOLDWARDEN_DO_NOT_PERSIST_CONFIG") == "true",
|
||||||
DisablePinRequirement: os.Getenv("GOLDWARDEN_PIN_REQUIREMENT_DISABLED") == "true",
|
DeviceUUID: os.Getenv("GOLDWARDEN_DEVICE_UUID"),
|
||||||
DoNotPersistConfig: os.Getenv("GOLDWARDEN_DO_NOT_PERSIST_CONFIG") == "true",
|
AuthMethod: os.Getenv("GOLDWARDEN_AUTH_METHOD"),
|
||||||
ApiURI: os.Getenv("GOLDWARDEN_API_URI"),
|
User: os.Getenv("GOLDWARDEN_AUTH_USER"),
|
||||||
IdentityURI: os.Getenv("GOLDWARDEN_IDENTITY_URI"),
|
Password: os.Getenv("GOLDWARDEN_AUTH_PASSWORD"),
|
||||||
SingleProcess: os.Getenv("GOLDWARDEN_SINGLE_PROCESS") == "true",
|
Pin: os.Getenv("GOLDWARDEN_PIN"),
|
||||||
DeviceUUID: os.Getenv("GOLDWARDEN_DEVICE_UUID"),
|
UseMemguard: os.Getenv("GOLDWARDEN_NO_MEMGUARD") != "true",
|
||||||
AuthMethod: os.Getenv("GOLDWARDEN_AUTH_METHOD"),
|
SSHAgentSocketPath: os.Getenv("GOLDWARDEN_SSH_AUTH_SOCK"),
|
||||||
User: os.Getenv("GOLDWARDEN_AUTH_USER"),
|
GoldwardenSocketPath: os.Getenv("GOLDWARDEN_SOCKET_PATH"),
|
||||||
Password: os.Getenv("GOLDWARDEN_AUTH_PASSWORD"),
|
DaemonAuthToken: os.Getenv("GOLDWARDEN_DAEMON_AUTH_TOKEN"),
|
||||||
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,
|
ConfigDirectory: configPath,
|
||||||
}
|
}
|
||||||
|
|
@ -67,18 +62,5 @@ func main() {
|
||||||
runtimeConfig.GoldwardenSocketPath = userHome + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
|
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)
|
cmd.Execute(runtimeConfig)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue