mirror of
https://github.com/schollz/croc.git
synced 2025-10-10 21:01:02 +02:00
fix: shared secret should be read from environmental variable
This commit is contained in:
parent
accb310337
commit
e255d472a6
1 changed files with 24 additions and 0 deletions
|
@ -321,6 +321,18 @@ func send(c *cli.Context) (err error) {
|
|||
// save the config
|
||||
saveConfig(c, crocOptions)
|
||||
|
||||
// if operating system is UNIX, then use environmental variable to set the code
|
||||
if runtime.GOOS == "linux" {
|
||||
cr.Options.SharedSecret = os.Getenv("CROC_SECRET")
|
||||
if cr.Options.SharedSecret == "" {
|
||||
fmt.Printf(`To use croc you need to set a code phrase using your environmental variables:
|
||||
|
||||
export CROC_SECRET="yourcodephrasetouse"
|
||||
`)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
err = cr.Send(minimalFileInfos, emptyFoldersToTransfer, totalNumberFolders)
|
||||
|
||||
return
|
||||
|
@ -536,6 +548,18 @@ func receive(c *cli.Context) (err error) {
|
|||
log.Debugf("wrote %s", configFile)
|
||||
}
|
||||
|
||||
// if operating system is UNIX, then use environmental variable to set the code
|
||||
if runtime.GOOS == "linux" {
|
||||
cr.Options.SharedSecret = os.Getenv("CROC_SECRET")
|
||||
if cr.Options.SharedSecret == "" {
|
||||
fmt.Printf(`To use croc you need to set a code phrase using your environmental variables:
|
||||
|
||||
export CROC_SECRET="yourcodephrasetouse"
|
||||
`)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
err = cr.Receive()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue