29 lines
837 B
Bash
29 lines
837 B
Bash
# vi: ft=bash
|
|
# shellcheck shell=bash
|
|
|
|
# If .env missing; restore from .env.example and validate
|
|
# See https://github.com/direnv/direnv/wiki/.envrc-Boilerplate
|
|
|
|
if [[ -f .env.sample ]]; then
|
|
if ! command -v createnv > /dev/null; then
|
|
echo 'WARN|https://github.com/cuducos/createnv'
|
|
fi
|
|
fi
|
|
|
|
if [[ -f .env.example ]]; then
|
|
if ! command -v createnv --source .env.example > /dev/null; then
|
|
echo 'WARN|https://github.com/cuducos/createnv'
|
|
elif [[ ! -f .env ]]; then
|
|
createnv --use-default --overwrite \
|
|
|| echo 'ERROR|https://github.com/cuducos/createnv'
|
|
if command dotenv-linter --version >&/dev/null; then
|
|
dotenv-linter .env || echo 'ERROR|https://dotenv-linter.github.io'
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
export LSP_AUTOSTART=1
|
|
dotenv_if_exists || direnv status # https://direnv.net/man/direnv-stdlib.1.html
|
|
|
|
use flake;
|
|
|