mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-08 03:18:33 +03:00
refactor encrypt script to be more readable
This commit is contained in:
@@ -13,5 +13,7 @@ script:
|
||||
- yarn lint
|
||||
- yarn test
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_eeb74e8d35d1_key -iv $encrypted_eeb74e8d35d1_iv
|
||||
-in .env.enc -out .env -d
|
||||
- openssl aes-256-cbc -K $encrypted_fb307c69bf51_key -iv $encrypted_fb307c69bf51_iv
|
||||
-in .env.enc -out .env -d
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
#!/bin/bash
|
||||
echo "Encrypting .env file for Travis..."
|
||||
if hash travis 2>/dev/null; then
|
||||
if [ ! -f .env ]; then
|
||||
echo "============================================================================================"
|
||||
echo "ERROR: You must create a .env file and add your credentials. See .env.example for an example"
|
||||
echo "============================================================================================"
|
||||
exit 3
|
||||
else
|
||||
travis encrypt-file .env --add --force --org
|
||||
git add .env.enc
|
||||
git add .travis.yml
|
||||
echo ".env.enc created and added to commit"
|
||||
fi
|
||||
else
|
||||
|
||||
# confirm that user has access to forensic architecture datasheet
|
||||
# if [ ! -z "$(travis repos | grep "forensic-architecture/datasheet-server")" ]
|
||||
# echo "No travis encrypt possible, skipping this step."
|
||||
# exit 0
|
||||
# fi
|
||||
|
||||
# confirm travis is installed
|
||||
if [ ! hash travis 2>/dev/null ]; then
|
||||
echo "============================================================================================"
|
||||
echo "ERROR: Travis CLI is not installed on your local. Please install from:"
|
||||
echo "\thttps://github.com/travis-ci/travis.rb"
|
||||
@@ -21,3 +17,16 @@ else
|
||||
echo "============================================================================================"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# confirm there is a .env file to encrypt
|
||||
if [ ! -f .env ]; then
|
||||
echo "============================================================================================"
|
||||
echo "ERROR: You must create a .env file and add your credentials. See .env.example for an example"
|
||||
echo "============================================================================================"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
travis encrypt-file .env --add --force --org
|
||||
git add .env.enc
|
||||
git add .travis.yml
|
||||
echo ".env.enc created and added to commit"
|
||||
|
||||
Reference in New Issue
Block a user