-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.sh
executable file
·85 lines (79 loc) · 3.77 KB
/
env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
#------------------------------------------------------------------------------
# env.sh
#
# Holds environment variables and paths that other scripts can reuse.
# Typically, this file is sourced by header.sh (which sets SCRIPT_DIR first).
#
# Exports:
# TMP_FOLDER_NAME : Temporary folder name
# BLOG_REPO_NAME : Name of the blog repository
# WP_ENV_PATH : Path to the .env file within WordPress
# WP_ENV_DIR : Directory that holds WordPress environment config
# GPG_PARAPHRASE_PATH : Path to the user's GPG paraphrase file
# list_of_files_to_delete : Array of files/directories to remove prior to deploy
# PATH_TO_TMP_FOLDER : Absolute path to the temporary folder
# PATH_TO_BLOG_REPO : Absolute path to the blog repository within the temp folder
# PATH_TO_BLOG_ENV : Absolute path to the blog environment config
# PATH_TO_GITIGNORE_WPE : Absolute path to the WP Engine gitignore template
# THIS_TIMESTAMP : Current timestamp in the format "YYYY.MM.DD-HHMMSS"
# BLOG_GIT_REPO : GitHub repository URL (placeholder)
# WPE_GIT_DEV/STAG/PROD : WP Engine Git repo URLs (placeholders)
# WPE_SSH_DEV/STAG/PROD : WP Engine SSH credentials (placeholders)
#
# Author: Wasseem Khayrattee
# GitHub: https://github.com/wkhayrattee
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# GITHUB & WP ENGINE REPOSITORY/SSH PLACEHOLDERS
#------------------------------------------------------------------------------
# todo: Adjust these values to match your own GitHub & WP Engine environments.
## Your Project's Git repo
export BLOG_GIT_REPO="[email protected]:YOURORG/YOURPROJECT.git"
## WP Engine Git repos - DEV, STAG, PROD
export WPE_GIT_DEV="[email protected]:production/ENVdevblog.git"
export WPE_GIT_STAG="[email protected]:production/ENVstag.git"
export WPE_GIT_PROD="[email protected]:production/ENVprod.git"
## WP Engine SSH credentials - DEV, STAG, PROD
export WPE_SSH_DEV="ssh [email protected]"
export WPE_SSH_STAG="ssh [email protected]"
export WPE_SSH_PROD="ssh [email protected]"
#------------------------------------------------------------------------------
# todo: Enable GPG encryption/decryption is you are using it like I do.
#------------------------------------------------------------------------------
export RUN_GPG_DECRYPT="false" # true or false
#------------------------------------------------------------------------------
# BASIC VARIABLES
#------------------------------------------------------------------------------
export TMP_FOLDER_NAME='tmp'
export BLOG_REPO_NAME='wpblog'
export WP_ENV_PATH='wp-content/app/config/.env'
export WP_ENV_DIR='wp-content/app/config/'
export GPG_PARAPHRASE_PATH="$HOME/.paraphrase_gpg"
# Array of items to delete before deployment
export list_of_files_to_delete=(
"composer.json"
"composer.lock"
"meta"
"bin"
"deploy"
".php_cs"
".php_cs.cache"
"README.md"
"CHANGELOG.md"
"LICENSE.md"
"license.txt"
"readme.html"
"wp-content/app/config/*.gpg"
"wp-content/app/config/test_env"
)
#------------------------------------------------------------------------------
# DEPENDENT PATHS (Require SCRIPT_DIR from header.sh)
#------------------------------------------------------------------------------
export PATH_TO_TMP_FOLDER="${SCRIPT_DIR}/${TMP_FOLDER_NAME}"
export PATH_TO_BLOG_REPO="${PATH_TO_TMP_FOLDER}/${BLOG_REPO_NAME}"
export PATH_TO_BLOG_ENV="${PATH_TO_BLOG_REPO}/wp-content/app/config/"
export PATH_TO_GITIGNORE_WPE="${SCRIPT_DIR}/file_templates/gitignore_wpe"
# For a timestamp in the format "YYYY.MM.DD-HHMMSS"
export THIS_TIMESTAMP="$(date +"%Y.%m.%d-%H%M%S")"