greppability#
- greppability
/ˈɡrɛpəˌbɪlɪti/ noun
The degree to which a codebase can be searched.
Etymology:
Derived from
grep(a Unix command-line utility for searching plain-text data for lines that match a regular expression) + the suffix -ability.
environment variables#
A simple grep FOO_ENV_VAR should show all locations in code where the environment variable is used.
do not construct environment variables#
Refuse the temptation to generate environment variable names.
List of offenders:
MONGO_DB_NAME_${dbName.toUpperCase()}(you know who you are 😉)
As always: practicality beats purity. If you have 100s of CLI flags and need some way to make your tool completely configurable via env vars, then by all means…
do not transform names#
For example when rendering templates, simply pass names through. It makes it so much easier to grep, for example:
.env
FOO=bar
deploy.py
from pyinfra.operations import files
foo_conf = files.template(
src='templates/svc.j2',
FOO=FOO,
)
templates/svc.j2
my_service_foo={{ FOO }}