Browse Source

Get rid of .env file in standard configuration.

master
Reinhard Müller 6 days ago
parent
commit
9629d1380b
6 changed files with 22 additions and 70 deletions
  1. 0
    1
      .dockerignore
  2. 0
    1
      .drone.yml
  3. 0
    24
      .env
  4. 3
    0
      .gitignore
  5. 6
    0
      Makefile
  6. 13
    44
      doc/configure.md

+ 0
- 1
.dockerignore View File

@@ -8,7 +8,6 @@ Dockerfile
Dockerfile-quality
.dockerignore
.drone.yml
.env
fake-smtp-server
.git
.gitignore

+ 0
- 1
.drone.yml View File

@@ -27,7 +27,6 @@ pipeline:
quality:
image: fsfe-forms-quality
commands:
- export $(grep -v "#" .env)
- isort --check-only --diff
- pylama
- pytest

+ 0
- 24
.env View File

@@ -1,24 +0,0 @@
# =============================================================================
# Configuration parameters for the development environment
# =============================================================================
# This file is part of the FSFE Form Server.
#
# Copyright © 2017-2019 Free Software Foundation Europe <contact@fsfe.org>
#
# The FSFE Form Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# The FSFE Form Server is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details <http://www.gnu.org/licenses/>.
# =============================================================================

# Parameters for Flask and the wsgi server
FLASK_SKIP_DOTENV=1
FLASK_APP=fsfe_forms
FLASK_ENV=development
FLASK_RUN_HOST=localhost
FLASK_RUN_PORT=8080

+ 3
- 0
.gitignore View File

@@ -1,3 +1,6 @@
# Local configuration
.env

# Created by Python running locally
__pycache__/


+ 6
- 0
Makefile View File

@@ -18,6 +18,12 @@

SOURCE_DIR = fsfe_forms

export FLASK_SKIP_DOTENV = 1
export FLASK_APP = ${SOURCE_DIR}
export FLASK_ENV = development
export FLASK_RUN_HOST = localhost
export FLASK_RUN_PORT = 8080

.DEFAULT_GOAL := help

GREEN = $(shell tput -Txterm setaf 2)

+ 13
- 44
doc/configure.md View File

@@ -1,46 +1,15 @@
# How to configure fsfe-forms

Configuration parameters for fsfe-forms must be set through environment
Configuration parameters for fsfe-forms can be set through environment
variables.

The configuration for the production instance of fsfe-forms is set in
[`docker-compose.yml`]. On the other hand, the file [`.env`], which is read
automatically when entering the “pipenv” virtual environment, contains settings
suitable for testing and debugging.


## Flask server settings

These settings are only relevant for the Flask builtin web server, which is
very nice for testing and debugging, but not recommended for production.


### `FLASK_SKIP_DOTENV`

In the virtual environment setup used for the development of fsfe-forms, the
.env file is parsed by `pipenv`, so we always set this to `1`.


### `FLASK_APP`

This tells the Flask server where to find the application object. Always set to
`fsfe_cd_front`.
For testing and debugging, the default configuration should be suitable for
many use cases. If you need to explicity set any of the parameters, you can
create a `.env` file in the project root directory, which will automatically be
read whenever the "pipenv" virtual environment is entered.


### `FLASK_ENV`

Since we don't use the Flask server for production, this is always set to
`development`.


### `FLASK_RUN_HOST`

The hostname to listen on.


### `FLASK_RUN_PORT`

The TCP port to listen on.
The configuration for the production instance of fsfe-forms is set in
[`docker-compose.yml`].


## Ratelimit settings
@@ -49,6 +18,7 @@ The TCP port to listen on.

The default rate limit in the format described
[here](https://flask-limiter.readthedocs.io/en/stable/#ratelimit-string).
Defaults to no rate limit.


## Email settings
@@ -62,30 +32,29 @@ to `localhost` and `25`.
### `MAIL_USERNAME` and `MAIL_PASSWORD`

The credentials for the SMTP server. Only needed if the SMTP server requires
authentication.
authentication. Defaults to no authentication.


### `LOG_EMAIL_FROM` and `LOG_EMAIL_TO`

In a production environment, fsfe-forms sends log messages of severity
“ERROR” or worse by email. These are the “From” and “To“ address for these
emails.
emails. No default.


## Parameters for the connection to the Redis server

### `REDIS_HOST` and `REDIS_PORT`

Hostname and TCP port of the Redis server.
Hostname and TCP port of the Redis server. Defaults to `localhost` and `6379`.

### `REDIS_PASSWORD`

Optional password for the Redis connection.
Optional password for the Redis connection. Defaults to no password.

### `REDIS_QUEUE_DB`

Redis database number for the double opt-in queue.
Redis database number for the double opt-in queue. Defaults to `0`.


[`docker-compose.yml`]: ../docker-compose.yml
[`.env`]: ../.env

Loading…
Cancel
Save