]>
Commit | Line | Data |
---|---|---|
399d20ea FP |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
fd5e57bb C |
4 | # Populate config directory |
5 | if [ -z "$(ls -A /config)" ]; then | |
6 | cp /app/support/docker/production/config/* /config | |
fd5e57bb C |
7 | fi |
8 | ||
b44a9630 C |
9 | # Always copy default configuration file, in cases where new keys were added |
10 | cp /app/config/default.yaml /config | |
11 | chown -R peertube:peertube /config | |
12 | ||
399d20ea FP |
13 | # first arg is `-f` or `--some-option` |
14 | # or first arg is `something.conf` | |
15 | if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then | |
4aeb67a5 | 16 | set -- npm "$@" |
399d20ea FP |
17 | fi |
18 | ||
19 | # allow the container to be started with `--user` | |
33837e8b | 20 | if [ "$1" = 'npm' -a "$(id -u)" = '0' ]; then |
4aeb67a5 C |
21 | chown -R peertube:peertube /data |
22 | exec gosu peertube "$0" "$@" | |
399d20ea FP |
23 | fi |
24 | ||
25 | exec "$@" |