Don't override plugin directories in docker image
This commit is contained in:
parent
7e06eadfd0
commit
26c1d6571c
1 changed files with 17 additions and 17 deletions
|
@ -4,24 +4,24 @@ function fixperms {
|
||||||
chown -R $UID:$GID /var/log /data /opt/maubot
|
chown -R $UID:$GID /var/log /data /opt/maubot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fixdefault {
|
||||||
|
_value=$(yq e "$1" /data/config.yaml)
|
||||||
|
if [[ "$_value" == "$2" ]]; then
|
||||||
|
yq e -i "$1 = "'"'"$3"'"' /data/config.yaml
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function fixconfig {
|
function fixconfig {
|
||||||
# If the DB path is the default relative path, replace it with an absolute /data path
|
# Change relative default paths to absolute paths in /data
|
||||||
_db_url=$(yq e '.database' /data/config.yaml)
|
fixdefault '.database' 'sqlite:///maubot.db' 'sqlite:////data/maubot.db'
|
||||||
if [[ _db_url == "sqlite:///maubot.db" ]]; then
|
fixdefault '.plugin_directories.upload' './plugins' '/data/plugins'
|
||||||
yq e -i '.database = "sqlite:////data/maubot.db"' /data/config.yaml
|
fixdefault '.plugin_directories.load[0]' './plugins' '/data/plugins'
|
||||||
fi
|
fixdefault '.plugin_directories.trash' './trash' '/data/trash'
|
||||||
_log_path=$(yq e '.logging.handlers.file.filename' /data/config.yaml)
|
fixdefault '.plugin_directories.db' './plugins' '/data/dbs'
|
||||||
if [[ _log_path == "./maubot.log" ]]; then
|
fixdefault '.plugin_directories.db' './dbs' '/data/dbs'
|
||||||
yq e -i '.logging.handlers.file.filename = "/var/log/maubot.log"' /data/config.yaml
|
fixdefault '.logging.handlers.file.filename' './maubot.log' '/var/log/maubot.log'
|
||||||
fi
|
# This doesn't need to be configurable
|
||||||
# Set the correct resource paths
|
yq e -i '.server.override_resource_path = "/opt/maubot/frontend"'
|
||||||
yq e -i '
|
|
||||||
.server.override_resource_path = "/opt/maubot/frontend" |
|
|
||||||
.plugin_directories.upload = "/data/plugins" |
|
|
||||||
.plugin_directories.load = ["/data/plugins"] |
|
|
||||||
.plugin_directories.trash = "/data/trash" |
|
|
||||||
.plugin_directories.db = "/data/dbs"
|
|
||||||
' /data/config.yaml
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cd /opt/maubot
|
cd /opt/maubot
|
||||||
|
|
Loading…
Reference in a new issue