EpocDotFr / webtodotxt

Web-based GUI to manage a Todo.txt file
Other
31 stars 7 forks source link

Subdirectory deployment #26

Open Strubbl opened 6 years ago

Strubbl commented 6 years ago

Hello, with the changes in this PR i am able to deploy webtodotxt in a subpath, e.g. https://asdf.nextcloud.example.de/todotxt/

I implemented the changes in a way that the default values are not changed if there were no environment variables given.

This PR is going to fix #24

JFYI: Now, my docker command to deploy it like that is:

docker create --name $CONTAINERNAME -p 3006:9000 -e SECRET_KEY=supersecret -e AUTH_BACKEND=WebDavAuth -e STORAGE_BACKEND=WebDav -e TODO_FILE_PATH=/remote.php/webdav/todo.txt -e WEBDAV_HOST=https://asdf.nextcloud.example.de -e WEBTODOTXT_STATIC_URL_PATH=/todotxt-static -e WEBTODOTXT_FORCE_ROOT_URL=https://asdf.nextcloud.example.de/todotxt/ strubbl_webtodotxt

My nginx config looks like that:

        location /todotxt-static {                                                                                                                                                                                                                            
          rewrite /todotxt-static(/.*) https://asdf.nextcloud.example.de/todotxt/todotxt-static$1 break;                                                                                                                                                                
        }                                                                                                                                                                                                                                                     
        location /todotxt/ {                                                                                                                                                                                                                                  
          proxy_pass http://127.0.0.1:3006/;                                                                                                                                                                                                                  
          proxy_set_header Host $host;                                                                                                                                                                                                                        
          proxy_set_header X-Real-IP $remote_addr;                                                                                                                                                                                                            
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;                                                                                                                                                                                        
          proxy_set_header X-Scheme $scheme;                                                                                                                                                                                                                  
        }
Strubbl commented 6 years ago

@EpocDotFr what is your opinion about this PR? Are you going to merge it? Do you want me to change anything?