Skip to content

[WIP] Fix Docker not using environment variables for notes - #64

Closed
omarmir with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-docker-env-variables
Closed

omarmir with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-docker-env-variables

Conversation

Copilot AI commented Dec 7, 2025 •

Copy link
Copy Markdown

Fix Docker environment variables not being used

The issue is in server/folder.ts where the code checks if environment variable paths exist before using them. In Docker, when volumes are mounted, the subdirectories may not exist yet, causing the app to fall back to default /src paths.

Plan:

  • Analyze the current logic in server/folder.ts
  • Fix the path resolution logic to prioritize environment variables
  • Create a test to verify the fix works correctly
  • Build and test the changes
  • Verify the fix handles all edge cases
Original prompt

This section details on the original issue you should resolve

<issue_title>Docker not using environment variables for notes</issue_title>
<issue_description>Hello,

I am trying to install the app using the compose.yml that is on this repo, but apparently the app is not making use of the variables:

environment:
  - NOTES_PATH=/nanote/notes
  - UPLOAD_PATH=/nanote/uploads
  - CONFIG_PATH=/nanote/config
volumes:
  - ./nanote:/nanote

I find the app writing everything in /src, as I guess is its default conf:

javi@laptop01:~/containers/nanote$ docker exec -ti nanote-nanote-1 bash
root@82b56e2acf38:/src# ls -lash
total 28K
4.0K drwxr-xr-x 1 root root 4.0K Dec  6 17:58 .
4.0K drwxr-xr-x 1 root root 4.0K Dec  6 17:58 ..
4.0K drwxr-xr-x 4 root root 4.0K Aug 28 16:57 .output
4.0K drwxr-xr-x 3 root root 4.0K Dec  6 17:58 config
4.0K drwxr-xr-x 3 root root 4.0K Dec  6 17:59 notes
4.0K drwxr-xr-x 3 root root 4.0K Aug 28 16:57 server
4.0K drwxr-xr-x 2 root root 4.0K Dec  6 17:58 uploads
root@82b56e2acf38:/src# ls -lash notes/
total 12K
4.0K drwxr-xr-x 3 root root 4.0K Dec  6 17:59 .
4.0K drwxr-xr-x 1 root root 4.0K Dec  6 17:58 ..
4.0K drwxr-xr-x 2 root root 4.0K Dec  6 17:59 test_notebook
root@82b56e2acf38:/src# ls -lash notes/test_notebook/
total 8.0K
4.0K drwxr-xr-x 2 root root 4.0K Dec  6 17:59 .
4.0K drwxr-xr-x 3 root root 4.0K Dec  6 17:59 ..
   0 -rw-r--r-- 1 root root    0 Dec  6 17:59 test_note.md
root@82b56e2acf38:/src#

However, if i set the volume to mount the /src folder, like:

volumes:
  - ./nanote:/src

It wont boot because its missing folders and configuration</issue_description>

Comments on the Issue (you are @copilot in this section)

@omarmir Hmmm, strange. Look at the compose.yaml file in this repo?

docker exec -it nanote /bin/bash

Then once inside nanote, try env

See if the variables are there? If they are there, then maybe navigate in cd / and then ls and see if its all there?

@omarmir Can you post your full compose file? Ill try to run it here and see if I can replicate the issue. @omarmir Ok ill try it tonight. I wonder if its the relative path it doesn't like for the volume. Ill check. @omarmir Yeah relative paths can be problematic. The problem arises because Docker Compose resolves relative paths differently depending on where the docker compose command is executed. And if the paths it resolves to a location that doesn't exist then it falls back to src.

Can you try to define the absolute path and let me know if it works?</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@omarmir
omarmir marked this pull request as ready for review December 7, 2025 04:24
@omarmir omarmir closed this Dec 7, 2025
Copilot AI requested a review from omarmir December 7, 2025 04:26
@omarmir
omarmir deleted the copilot/fix-docker-env-variables branch December 7, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker not using environment variables for notes

2 participants