Skip to content

Commit

Permalink
Merge pull request #19 from theohbrothers/docs/readme-add-secrets-sec…
Browse files Browse the repository at this point in the history
…tion-about-how-to-separate-configuration-from-secrets

Docs (readme): Add Secrets section about how to separate configuration from secrets
  • Loading branch information
leojonathanoh authored Apr 15, 2023
2 parents 58f87dd + de98fbf commit 4beffe0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ For cron-based sync and backup with notifications, see `docker-compose` example(
- [Cron-based sync and backup (same container) with curl notifications](docs/examples/cron-sync-backup)
- [Cron-based sync and backup (separate containers) with curl notifications](docs/examples/cron-sync-backup-separate)

### Secrets

Instead of typing secrets as plain text in `/mbsyncrc` config file for the `User` and `Pass` options of `IMAPStore` (or `IMAPAccount`), use `UserCmd` or `PassCmd` which accepts a [shell command](https://isync.sourceforge.io/mbsync.html). This helps to separate configuration from secrets.

For example, if secrets are bind mounted as files in `/run/secrets/user` and `/run/secrets/pass`, use the following:

```sh
UserCmd "cat /run/secrets/user"
PassCmd "cat /run/secrets/pass"
```

If secrets are in environment variables `IMAP_USER` and `IMAP_PASS`, use the following:

```sh
UserCmd "echo $IMAP_USER"
PassCmd "echo $IMAP_PASS"
```

### Command line usage

To view command line usage:
Expand Down
18 changes: 18 additions & 0 deletions generate/templates/README.md.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,24 @@ For cron-based sync and backup with notifications, see `docker-compose` example(
- [Cron-based sync and backup (same container) with curl notifications](docs/examples/cron-sync-backup)
- [Cron-based sync and backup (separate containers) with curl notifications](docs/examples/cron-sync-backup-separate)
### Secrets
Instead of typing secrets as plain text in `/mbsyncrc` config file for the `User` and `Pass` options of `IMAPStore` (or `IMAPAccount`), use `UserCmd` or `PassCmd` which accepts a [shell command](https://isync.sourceforge.io/mbsync.html). This helps to separate configuration from secrets.
For example, if secrets are bind mounted as files in `/run/secrets/user` and `/run/secrets/pass`, use the following:
```sh
UserCmd "cat /run/secrets/user"
PassCmd "cat /run/secrets/pass"
```
If secrets are in environment variables `IMAP_USER` and `IMAP_PASS`, use the following:
```sh
UserCmd "echo $IMAP_USER"
PassCmd "echo $IMAP_PASS"
```
### Command line usage
To view command line usage:
Expand Down

0 comments on commit 4beffe0

Please sign in to comment.