Skip to content

Commit

Permalink
Continue secret:generate, adds skeleton for secret:install
Browse files Browse the repository at this point in the history
  • Loading branch information
radiospiel committed Jan 6, 2020
1 parent a45c9f7 commit d2bdbfb
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/secret-install-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env roundup
set -eu -o pipefail


describe "envy secret:install"

before() {
rm -rf tmp/spec/*
}

it_is_listed_in_help() {
($ENVY help 2>&1) | grep -w secret:install
}

it_installs_the_secret() {
SSH=false ENVY_SECRET_PATH=tmp/spec/envy.secret $ENVY secret:install target@system

test 1 == 2
# # secret file has 32 byte
# test 32 -eq $(cat tmp/spec/envy.secret | wc -c)
#
# # secret file is 0400
# test '-r--------' == $(ls -l tmp/spec/envy.secret | awk '{ print $1 }')
}
7 changes: 7 additions & 0 deletions src/golang/cli/secret_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ import "github.com/spf13/cobra"

import ()

/*
* Copy the current secret via ${SSH_BINARY:-ssh} to a target account.
*/
func do_secret_generate() {
}

func init() {
var cmd = &cobra.Command{
Use: "secret:generate",
Short: "Generate the envy secret",
Long: `Generate the envy secret`,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
do_secret_generate()
},
}

Expand Down
25 changes: 25 additions & 0 deletions src/golang/cli/secret_install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package cli

import "github.com/spf13/cobra"

import ()

/*
* Copy the current secret via ${SSH_BINARY:-ssh} to a target account.
*/
func do_secret_install(target_account string) {
}

func init() {
var cmd = &cobra.Command{
Use: "secret:install",
Short: "Install the current envy secret to a remote location",
Long: `Install the current envy secret to a remote location`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
do_secret_install(args[0])
},
}

rootCmd.AddCommand(cmd)
}

0 comments on commit d2bdbfb

Please sign in to comment.