You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
863 B

11 months ago
#!/usr/bin/env bash
HERE="$(cd "$(dirname "$0")" && pwd)"
BASEDIR="$(cd "$(dirname "$1")" && pwd)"
CHARS="abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)"
for ((i=0;i<${#CHARS};i++)); do ARRAY[$i]="${CHARS:i:1}"; done
MSG_SUCCESS="DONE!"
POETRY=0
PYTHON=0
key_gen() {
for ((c=1; c<=50; c++)); do
KEY="$KEY${ARRAY[$((RANDOM % 50))]}"
done
echo $KEY
}
make_env_file() {
if [[ ! -f ".env" ]]; then
ENV="SECRET_KEY='$(key_gen)'\n
ALLOWED_HOSTS=localhost, 10.0.2.2, 127.0.0.1\n
DEBUG=True\n\n
"
$(echo -e $ENV | sed -e 's/^[ \t]*//' > .env)
echo "ENV FILE - $MSG_SUCCESS"
fi
}
help() {
awk 'BEGIN {FS="## @ "; print "Usage: make";} /^## @ / { printf "\033[31m\n" substr($1, 5) "\n";} {FS=" ## ";} /^[a-zA-Z_-]+:.*? ##/ { print "\033[33m -", $1 "\033[37m", $2}' $ARG
}
ARG=$2
$1