Filesystem uploads in codimd container

My version of CodiMD is: 1.6.0 (container)

What is expected to happen:
After setting CMD_IMAGE_UPLOAD_TYPE=filesystem
and adding a volume for storage to the docker-compose.yml file:

app:
  volumes:
    - uploads:/codimd/public/uploads
[...]
volumes:
  # Volume for PostgreSQL/MySQL database
  database:
  uploads:

When uploading an image, the file should be stored in the docker volume and the image link added to the note

What actually happened:
The file is indeed uploaded (can be found in the docker container), but the container crashes and the note is not modified accordingly

After discussion with @sheogorath, the domain must be properly set for this to work

Setting the environment variable CMD_DOMAIN fixes the issue (in my case, being behind a reverse proxy, I had to also add CMD_URL_ADDPORT=false and CMD_PROTOCOL_USESSL=true)

For better searchability the error message that was reported was:

error: 	uncaughtException: Invalid URL: /uploads/
TypeError [ERR_INVALID_URL]: Invalid URL: /uploads/
    at onParseError (internal/url.js:257:9)
    at new URL (internal/url.js:333:5)
    at new URL (internal/url.js:330:22)
    at Object.exports.uploadImage (/codimd/lib/web/imageRouter/filesystem.js:19:19)
    at /codimd/lib/web/imageRouter/index.js:31:22
    at IncomingForm.<anonymous> (/codimd/node_modules/formidable/lib/incoming_form.js:107:9)
    at IncomingForm.emit (events.js:311:20)
    at IncomingForm._maybeEnd (/codimd/node_modules/formidable/lib/incoming_form.js:557:8)
    at /codimd/node_modules/formidable/lib/incoming_form.js:238:12
    at WriteStream.<anonymous> (/codimd/node_modules/formidable/lib/file.js:79:5)
    at Object.onceWrapper (events.js:417:28)
    at WriteStream.emit (events.js:311:20)
    at finishMaybe (_stream_writable.js:687:14)
    at _stream_writable.js:664:5
    at WriteStream._final (internal/fs/streams.js:311:3)
    at callFinal (_stream_writable.js:657:10)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
2020-03-09T14:45:57.318Z error: 	An uncaught exception has occured.
2020-03-09T14:45:57.318Z error: 	Invalid URL: /uploads/
2020-03-09T14:45:57.319Z error: 	Process will exit now.

Additional hint: This is definitely going to be fixed in 2.0. We are currently working on getting the config figured out. But since the base URL will then be required to set properly, this problem should go away.

I’m way late to this thread, but I’m experienci g this issue right now and want to make sure I know what I’m doing when I try these changes. If my instance is running at https[:]//codimd[.]neodymium.com, what should my env vars be? I’ve tried codimd.neodymium[.]com and https[:]//codimd.neodymium.com, but I never tried the url_addport or protocol_usessl vars.