Skip to content

Common Configuration⚓︎

🖥 Operating System⚓︎

We recommend using unix-like operating systems to make development easier. If you are on windows, you can use the following options to have unix-like development environment:

  • Windows Subsystem for Linux (WSL) (highly recommended) - The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.
  • gitbash - An application for Microsoft Windows environments which provides an emulation layer for a Git command line experience.
  • cygwin - Cygwin is a collection of open source tools that allows Unix or Linux applications to be compiled and run on a Microsoft Windows operating system (OS) from within a Linux-like interface.
  • choco - Package manager for windows.
  • powershell - Powershell is a Windows command-line shell.

📁 Files⚓︎

.gitignore⚓︎

We use this tool to generate a .gitignore file based on the project's type.

.gitattributes⚓︎

We use this repo to create a .gitattributes file based on the project's type.

.tool-versions⚓︎

Global⚓︎

Place this in your home ~ directory.

direnv 2.31.0
nodejs 16.13.2
pnpm 7.1.5
java adoptopenjdk-8.0.272+10
minikube 1.25.1
helm 3.6.3
helmfile 0.139.9
kubectl 1.23.3
kubespy 0.6.0
kubectx 0.9.4
jq 1.6
golang 1.15.15
poetry 1.1.13

Note

Make sure you stay up to date with the latest or stable versions of the tools.

Local⚓︎

The local version of the .tool-versions file depends on the project type.

.envrc⚓︎

#!/usr/bin/env bash

layout node

# Util
export PROJ_ROOT="$(git rev-parse --show-toplevel)"

# Load asdf
if ! has asdf; then
    log_error "ASDF is cool, you should get it fool."
else
    use asdf
fi

#: GitHub Personal Access Token
export GITHUB_PAT_PKG=${GITHUB_TOKEN:-}
export NODE_AUTH_TOKEN=$GITHUB_PAT_PKG
##: GHCR Docker Registry
export DOCKER_USERNAME=your-github-handle
export DOCKER_PASSWORD=$GITHUB_PAT_PKG
##: GITHUB Auth (fluxctl/gh/etc)
export GITHUB_USER=your-github-handle
export GITHUB_TOKEN=$GITHUB_PAT_PKG

#: Netlify
export NETLIFY_AUTH_TOKEN=${NETLIFY_AUTH_TOKEN:-}

#: Codecov
export CODECOV_TOKEN=${CODECOV_TOKEN:-}

#: Helm Config
export HELM_EXPERIMENTAL_OCI=1

#: AWS Config
export AWS_PROFILE=${AWS_PROFILE:-"your-aws-profile-name"}
export AWS_DEFAULT_REGION=us-east-1

##: EKS
export CLUSTER_NAME=

#: Sentry
export SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN:-}
export SENTRY_ORG=arroyodev

#: Docker
export DOCKER_BUILDKIT=1

##: Debugging
export DEBUG="*"
export DEBUG_COLORS=1

# Utilities

# Usage: mkbcrypt <password> [salt]
mkbcrypt() {
    local password="$1"
    local work_factor=${2:-10}
    npx -y bcrypt-cli "${1}" "${work_factor}"
}

if ! has export_function; then
    log_error "Cannot export utility functions! 'export_function' not found."
else
    export_function mkbcrypt
fi

# Local env + overrides.
source_env_if_exists .env.local

Make sure you have a ~/.config/direnv/direnvrc file with the following contents to use the export_function command above:

# source "$(asdf direnv hook asdf)"

# support for dir scoped functions and aliases
# see: https://github.com/direnv/direnv/issues/73

# see: https://github.com/direnv/direnv/issues/73#issuecomment-152284914
# example export_function my_func
export_function() {
  local name=$1
  local alias_dir=$PWD/.direnv/aliases
  mkdir -p "$alias_dir"
  PATH_add "$alias_dir"
  local target="$alias_dir/$name"
  if declare -f "$name" >/dev/null; then
    echo "#!$SHELL" > "$target"
    declare -f "$name" >> "$target" 2>/dev/null
    # Notice that we add shell variables to the function trigger.
    echo "$name \$*" >> "$target"
    chmod +x "$target"
  fi
}

# see: https://github.com/direnv/direnv/issues/73#issuecomment-174295790
# Example: export_alias zz "ls -la"
export_alias() {
  local name=$1
  shift
  local alias_dir=$PWD/.direnv/aliases
  local target="$alias_dir/$name"
  mkdir -p "$alias_dir"
  PATH_add "$alias_dir"
  echo "#!/usr/bin/env bash -e" > "$target"
  echo "$@" >> "$target"
  chmod +x "$target"
}

### Global common setup
# executed for all .envrc files

#
# Direnv bin dir
# ==============
#
_direnv_root=$(dirname "$(find_up .envrc)")
DIRENV_TMP_DIR="${_direnv_root}/.direnv"
DIRENV_BIN_DIR="${DIRENV_TMP_DIR}/bin"
[ ! -e "${DIRENV_BIN_DIR}" ] && mkdir -p "${DIRENV_BIN_DIR}"
export PATH="${DIRENV_BIN_DIR}:${PATH}"

# make direnv silent by default
#export DIRENV_LOG_FORMAT=""