If a file `env` exists in the folder `./jobs/` it will be sourced by the backup scripts.
Here you can set custom environment variables.

A common usage is extending the variable PATH to execute binaries that are not located in any directory.

Example:

This might be helpful on MS Windows. If you put the restic binary "somewhere" eg. c:\portable\restic\restic.exe then you can add the path to the env file:

```bash
PATH=/c/portable/restic/:$PATH
```

## Override parameters

In the file ``jobs/env_defaults`` are some vars to set some defaults for the command lines during backup.
Do not edit this file - it is part of the repository. To customize a value copy it to ``jobs/env`` and make your changes there.

```bash
#!/bin/bash
# ----------------------------------------------------------------------
#
# DEFAULTS !!! Do not edit this file !!! 
# Overide customizations in file "env" (maybe copy env.dist to env first)
#
# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
# Localdump
# ----------------------------------------------------------------------

# mysql
LD_MYSQL_DUMP_PARAMS="--opt \
            --default-character-set=utf8 \
            --flush-logs \
            --single-transaction \
            --no-autocommit \
            "

# ----------------------------------------------------------------------
# Restic backup
# ----------------------------------------------------------------------

# compression mode (only available for repository format version 2), one of (auto|off|max) (default: $RESTIC_COMPRESSION) (default auto)
# export RESTIC_COMPRESSION=auto

# Concurrency for file reads (default: 2)
# RESTIC_READ_CONCURRENCY=

# Target size for pack files
export RESTIC_PACK_SIZE=128

# injected in command line for restic backup (not a variable of restic)
RESTIC_PARAMS=--no-scan

# ----------------------------------------------------------------------
```

### Localdump :: Mysql

You can override used parameters during backup. The parameters for mysqldump are in env_defaults. If you want to change them then put ``LD_MYSQL_DUMP_PARAMS=...`` into env file.

### Localdump :: Pgsql

Postgres backup supports backups with a snapshot database using `CREATE DATABASE snapshot_<SCHEMA> WITH TEMPLATE <SCHEMA>`.
The backup script detects if a server is writable or readonly (slave). On a writable system the snapshot creation is activated.

The creation of a snapshot database fails if a user is connected on the origin database. It is posible to disconnect all users but shouldn't be triggered during production times. You can configure a night time when to allow the disconnect (default: disconnect between 22:00 and 02:00).

You can put these variables into env:

* LD_PGSQL_SNAPSHOTS=0 - disable snapshot on a writable database server
* LD_PGSQL_DISCONNECT_BEFORE - time in the morning until to allow disconnect; eg. "03:00"
* LD_PGSQL_DISCONNECT_AFTER - time in the night when to allow disconnect; eg "23:00"

### Transfer :: Restic

There are some environment variables for tuning

* RESTIC_COMPRESSION
* RESTIC_READ_CONCURRENCY
* RESTIC_PACK_SIZE

see <https://restic.readthedocs.io/en/latest/047_tuning_backup_parameters.html>