diff --git a/docs/using.rst b/docs/using.rst index 951c991d2..a9a4aa958 100644 --- a/docs/using.rst +++ b/docs/using.rst @@ -151,6 +151,27 @@ The ``letsencrypt`` commandline tool has a builtin help: ./venv/bin/letsencrypt --help +Configuration file +------------------ + +It is possible to specify configuration file with +``letsencrypt --config cli.ini`` (or shorter ``-c cli.ini``). For +instance, if you are a contributor, you might find the following +handy: + +.. include:: ../examples/dev-cli.ini + :code: ini + +By default, the following locations are searched: + +- ``/etc/letsencrypt/cli.ini`` +- ``$XDG_CONFIG_HOME/letsencrypt/cli.ini`` (or + ``~/.config/letsencrypt/cli.ini`` if ``$XDG_CONFIG_HOME`` is not + set). + +.. keep it up to date with constants.py + + .. _Augeas: http://augeas.net/ .. _M2Crypto: https://github.com/M2Crypto/M2Crypto .. _SWIG: http://www.swig.org/ diff --git a/examples/dev-cli.ini b/examples/dev-cli.ini new file mode 100644 index 000000000..761bc58c9 --- /dev/null +++ b/examples/dev-cli.ini @@ -0,0 +1,17 @@ +# This is an example configuration file for developers +config-dir = /tmp/le/conf +work-dir = /tmp/le/conf +logs-dir = /tmp/le/logs + +# make sure to use a valid email and domains! +email = foo@example.com +domains = example.com + +text = True +agree-eula = True +debug = True +# Unfortunately, it's not possible to specify "verbose" multiple times +# (correspondingly to -vvvvvv) +verbose = True + +authenticator = standalone diff --git a/letsencrypt/constants.py b/letsencrypt/constants.py index 1c3280006..4b0a215e1 100644 --- a/letsencrypt/constants.py +++ b/letsencrypt/constants.py @@ -1,4 +1,5 @@ """Let's Encrypt constants.""" +import os import logging from acme import challenges @@ -8,7 +9,12 @@ SETUPTOOLS_PLUGINS_ENTRY_POINT = "letsencrypt.plugins" """Setuptools entry point group name for plugins.""" CLI_DEFAULTS = dict( - config_files=["/etc/letsencrypt/cli.ini"], + config_files=[ + "/etc/letsencrypt/cli.ini", + # http://freedesktop.org/wiki/Software/xdg-user-dirs/ + os.path.join(os.environ.get("XDG_CONFIG_HOME", "~/.config"), + "letsencrypt", "cli.ini"), + ], verbose_count=-(logging.WARNING / 10), server="https://www.letsencrypt-demo.org/acme/new-reg", rsa_key_size=2048,