mirror of
https://github.com/overleaf/toolkit.git
synced 2025-04-19 15:28:06 +02:00
Consistently use two-space indentation
This commit is contained in:
parent
ec621c83ef
commit
20e99b5fe7
1 changed files with 30 additions and 30 deletions
60
bin/init
60
bin/init
|
@ -16,48 +16,48 @@ if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then
|
|||
fi
|
||||
|
||||
function usage() {
|
||||
echo "Usage: bin/init"
|
||||
echo ""
|
||||
echo "Initialises local configuration files in the 'config/' directory"
|
||||
echo ""
|
||||
echo "Usage: bin/init"
|
||||
echo ""
|
||||
echo "Initialises local configuration files in the 'config/' directory"
|
||||
echo ""
|
||||
}
|
||||
|
||||
function check_existing_config() {
|
||||
if [[ -f "$TOOLKIT_ROOT/config/overleaf.rc" ]] \
|
||||
|| [[ -f "$TOOLKIT_ROOT/config/variables.env" ]] \
|
||||
|| [[ -f "$TOOLKIT_ROOT/config/version" ]]; then
|
||||
echo "ERROR: Config files already exist, exiting "
|
||||
exit 1
|
||||
fi
|
||||
if [[ -f "$TOOLKIT_ROOT/config/overleaf.rc" ]] \
|
||||
|| [[ -f "$TOOLKIT_ROOT/config/variables.env" ]] \
|
||||
|| [[ -f "$TOOLKIT_ROOT/config/version" ]]; then
|
||||
echo "ERROR: Config files already exist, exiting "
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function set_up_config_files() {
|
||||
echo "Copying config files to 'config/'"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/overleaf.rc" "$TOOLKIT_ROOT/config/"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/variables.env" "$TOOLKIT_ROOT/config/"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/version" "$TOOLKIT_ROOT/config/"
|
||||
echo "Copying config files to 'config/'"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/overleaf.rc" "$TOOLKIT_ROOT/config/"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/variables.env" "$TOOLKIT_ROOT/config/"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/version" "$TOOLKIT_ROOT/config/"
|
||||
}
|
||||
|
||||
function set_up_tls_proxy() {
|
||||
PRIVATE_KEY="$TOOLKIT_ROOT/config/nginx/certs/overleaf_key.pem"
|
||||
CERT_SIGN_REQ="$TOOLKIT_ROOT/config/nginx/certs/overleaf_csr.pem"
|
||||
CERT="$TOOLKIT_ROOT/config/nginx/certs/overleaf_certificate.pem"
|
||||
echo "Generate example self-signed TLS cert"
|
||||
mkdir -p config/nginx/certs
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/nginx.conf" "$TOOLKIT_ROOT/config/nginx/"
|
||||
openssl req -new -nodes -keyout $PRIVATE_KEY -out $CERT_SIGN_REQ -batch
|
||||
chmod 600 $PRIVATE_KEY
|
||||
openssl x509 -req -days 365 -in $CERT_SIGN_REQ -signkey $PRIVATE_KEY -out $CERT
|
||||
PRIVATE_KEY="$TOOLKIT_ROOT/config/nginx/certs/overleaf_key.pem"
|
||||
CERT_SIGN_REQ="$TOOLKIT_ROOT/config/nginx/certs/overleaf_csr.pem"
|
||||
CERT="$TOOLKIT_ROOT/config/nginx/certs/overleaf_certificate.pem"
|
||||
echo "Generate example self-signed TLS cert"
|
||||
mkdir -p config/nginx/certs
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/nginx.conf" "$TOOLKIT_ROOT/config/nginx/"
|
||||
openssl req -new -nodes -keyout $PRIVATE_KEY -out $CERT_SIGN_REQ -batch
|
||||
chmod 600 $PRIVATE_KEY
|
||||
openssl x509 -req -days 365 -in $CERT_SIGN_REQ -signkey $PRIVATE_KEY -out $CERT
|
||||
}
|
||||
|
||||
function __main__() {
|
||||
if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
check_existing_config
|
||||
set_up_config_files
|
||||
set_up_tls_proxy
|
||||
if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
check_existing_config
|
||||
set_up_config_files
|
||||
set_up_tls_proxy
|
||||
}
|
||||
|
||||
__main__ "$@"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue