Skip to content

Commit

Permalink
Merge pull request #533 from hazelops/IZE-674-ssh-public-key-and-ssh-…
Browse files Browse the repository at this point in the history
…private-key-present-in-schema-as-env-vars-parmeters
  • Loading branch information
psihachina authored Nov 11, 2022
2 parents 4bf9ad9 + ccd9972 commit d660a10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/commands/tunnel_up.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ func (o *TunnelUpOptions) Complete() error {
os.Exit(0)
}

if o.PrivateKeyFile == "" && o.Config.Tunnel != nil {
o.PrivateKeyFile = o.Config.Tunnel.SSHPrivateKey
}

if o.PublicKeyFile == "" && o.Config.Tunnel != nil {
o.PublicKeyFile = o.Config.Tunnel.SSHPublicKey
}

if o.PrivateKeyFile == "" {
home, _ := os.UserHomeDir()
o.PrivateKeyFile = fmt.Sprintf("%s/.ssh/id_rsa", home)
Expand Down
2 changes: 2 additions & 0 deletions internal/config/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ type Terraform struct {
type Tunnel struct {
BastionInstanceID string `mapstructure:"bastion_instance_id,omitempty"`
ForwardHost []string `mapstructure:"forward_host,omitempty"`
SSHPublicKey string `mapstructure:"ssh_public_key,omitempty"`
SSHPrivateKey string `mapstructure:"ssh_private_key,omitempty"`
}
8 changes: 8 additions & 0 deletions internal/schema/ize-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@
"type": "string",
"description": "Forward host."
}
},
"ssh_private_key": {
"type": "string",
"description": "(optional) Path to SSH private key. Default: {user_home_directory}/.ssh/id_rsa"
},
"ssh_public_key": {
"type": "string",
"description": "(optional) Path to SSH public key. Default: {user_home_directory}/.ssh/id_rsa.pub"
}
},
"description": "Tunnel configuration.",
Expand Down

0 comments on commit d660a10

Please sign in to comment.