aboutsummaryrefslogtreecommitdiff
path: root/cmd/fscrypt
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-09 14:04:47 -0700
committerEric Biggers <ebiggers@google.com>2020-05-09 14:04:47 -0700
commit31bc8c843e1862b2d28f31eff85eca3d1dbd4754 (patch)
tree58e29416bc6072966b1b464e5b2fc2efc9d3731f /cmd/fscrypt
parent1aef2541a434bd9e88ebd52be72f13d56c5ef748 (diff)
cmd/fscrypt: add FSCRYPT_CONF environmental variable
Allow overriding the location of fscrypt.conf by setting the FSCRYPT_CONF environmental variable. The CLI tests need this to avoid touching the real /etc/fscrypt.conf.
Diffstat (limited to 'cmd/fscrypt')
-rw-r--r--cmd/fscrypt/fscrypt.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/fscrypt/fscrypt.go b/cmd/fscrypt/fscrypt.go
index e260f7f..069cc96 100644
--- a/cmd/fscrypt/fscrypt.go
+++ b/cmd/fscrypt/fscrypt.go
@@ -31,6 +31,8 @@ import (
"os"
"github.com/urfave/cli"
+
+ "github.com/google/fscrypt/actions"
)
// Current version of the program (set by Makefile)
@@ -41,6 +43,10 @@ func main() {
cli.CommandHelpTemplate = commandHelpTemplate
cli.SubcommandHelpTemplate = subcommandHelpTemplate
+ if conffile := os.Getenv("FSCRYPT_CONF"); conffile != "" {
+ actions.ConfigFileLocation = conffile
+ }
+
// Create our command line application
app := cli.NewApp()
app.Usage = shortUsage