Adjusting trusted_domains and support multiple ip
This commit is contained in:
@@ -15,10 +15,21 @@ rel_bind_folder=bind_folder
|
||||
bind_folder=$(pwd)/$rel_bind_folder
|
||||
|
||||
#lazzy detection base on first local ip
|
||||
listen_host=$(ip a | grep 192.168.1 |awk '{ gsub("/24","",$2); print $2 ; }')
|
||||
declare -a possible_hosts=($(ip a | grep 192.168.1 |awk '{ gsub("/24","",$2); print $2 ; }'))
|
||||
hosts_n=${#possible_hosts[@]}
|
||||
if (( hosts_n > 1 ))
|
||||
then
|
||||
log_warn "multiple hosts $hosts_n"
|
||||
fi
|
||||
listen_host=${possible_hosts[0]}
|
||||
log_info "liston on $listen_host"
|
||||
|
||||
declare -a podman_args
|
||||
podman_args+=(-p $listen_host:8080:80 --name=$container_name --replace)
|
||||
|
||||
host_free_port=8081
|
||||
log_warn "[TODO] detect free port on $listen_host, use $host_free_port"
|
||||
|
||||
podman_args+=(-p $listen_host:$host_free_port:80 --name=$container_name --replace)
|
||||
|
||||
# container 33 www-data => current user.
|
||||
current_uid=$(id -u)
|
||||
@@ -64,7 +75,13 @@ then
|
||||
podman_args+=(-d)
|
||||
fi
|
||||
|
||||
log_info 'Adjusting trusted_domains in ${bind_folder}/config/config.php'
|
||||
# assumes a php is installed locally, could be changed to use a podman image or container
|
||||
sudo cp ${bind_folder}/config/config.php .
|
||||
php patch_config.php "$listen_host:$host_free_port" | sudo tee ${bind_folder}/config/config.php
|
||||
|
||||
echo "run podman with args ${podman_args[@]}"
|
||||
log_info "run podman with args ${podman_args[@]}"
|
||||
|
||||
log_info "now you can start a browser on http://$listen_host:$host_free_port"
|
||||
|
||||
$defer $podman run "${podman_args[@]}" $nextcloud_image
|
||||
|
||||
Reference in New Issue
Block a user