1 $ source $TESTDIR/setup.sh
3 Lets set a simple .env action
5 $ echo 'echo ENTERED' >> .env
7 Manually create auth file
9 $ echo "$PWD/.env:$(echo echo ENTERED | shasum)" > $AUTOENV_ENV_FILENAME
13 Now try to make it accept it
15 $ unset _dotenv_stack_entered
16 $ rm $AUTOENV_ENV_FILENAME
17 $ _dotenv_read_answer() { echo 'y' }
19 Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
21 **********************************************
25 **********************************************
27 Would you like to authorize it? [y/N]
34 The last "ENTERED" is because it executed the command
36 Now lets see that it actually checks the shasum value
38 $ unset _dotenv_stack_entered
42 $ unset _dotenv_stack_entered
43 $ rm $AUTOENV_ENV_FILENAME
44 $ echo "$PWD/.env:$(echo mischief | shasum)" > $AUTOENV_ENV_FILENAME
46 Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
48 **********************************************
52 **********************************************
54 Would you like to authorize it? [y/N]
61 Now, will it take no for an answer?
63 $ unset _dotenv_stack_entered
64 $ rm $AUTOENV_ENV_FILENAME
65 $ _dotenv_read_answer() { echo 'n' }
67 Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
69 **********************************************
73 **********************************************
75 Would you like to authorize it? [y/N]
81 Lets also try one more time to ensure it didnt add it
84 Attempting to load unauthorized env file: /tmp/cramtests-??????/autoenv.t/.env (glob)
86 **********************************************
90 **********************************************
92 Would you like to authorize it? [y/N]