user-data-dir config does not expand ~ alias as user home
See original GitHub issueOS/Web Information
- Web Browser: Chrome
- Local OS: ChromeOS
- Remote OS: Manjaro
- Remote Architecture: Linux
code-server --version
: 3.10.2 387b12ef4ca404ffd39d84834e1f0776e9e3c005
Steps to Reproduce
I’m trying to follow https://github.com/cdr/code-server/blob/main/docs/FAQ.md#how-can-i-reuse-my-vs-code-configuration. The instructions indicate that ~
can be used within the value. I am trying to point at my local ~/.config/Code
for shared settings.
Create in ~/.config/code-server/config.yaml
:
bind-addr: 0.0.0.0:8443
auth: password
password: REDACTED
cert: false
user-data-dir: ~/.config/Code
I am then running code-server via systemctl start code-server@myusername.service
Expected
Code-server should run with shared settings of my ~/.config/Code directory
Actual
When opening in client, a blank screen is shown.
If the user-data-dir
in config.yml is instead replaced with the absolute path: /home/myusername/.config/Code
it loads properly.
I cannot alternatively get this to work with $HOME
.
This would be useful for code-server configs to be cross compatible between MacOS and Linux (where /home and /Users is often th differentiation).
Logs
Note the ‘Using user-data-dir’ line where it does not appear to expand ~
as expected:
Jun 28 09:06:28 d4bequiet code-server[31942]: [2021-06-28T13:06:28.307Z] info code-server 3.10.2 387b12ef4ca404ffd39d84834e1f0776e9e3c005
Jun 28 09:06:28 d4bequiet code-server[31942]: [2021-06-28T13:06:28.308Z] info Using user-data-dir /~/.config/Code
Jun 28 09:06:28 d4bequiet code-server[31942]: [2021-06-28T13:06:28.316Z] info Using config file ~/.config/code-server/config.yaml
Jun 28 09:06:28 d4bequiet code-server[31942]: [2021-06-28T13:06:28.316Z] info HTTP server listening on http://0.0.0.0:8443
Jun 28 09:06:28 d4bequiet code-server[31942]: [2021-06-28T13:06:28.316Z] info - Authentication is enabled
Jun 28 09:06:28 d4bequiet code-server[31942]: [2021-06-28T13:06:28.316Z] info - Using password from ~/.config/code-server/config.yaml
Jun 28 09:06:28 d4bequiet code-server[31942]: [2021-06-28T13:06:28.316Z] info - Not serving HTTPS
Jun 28 09:06:31 d4bequiet code-server[31942]: [2021-06-28T13:06:31.978Z] error vscode is not running Error: vscode is not running
Jun 28 09:06:31 d4bequiet code-server[31942]: at VscodeProvider.send (/usr/lib/code-server/out/node/vscode.js:206:19)
Jun 28 09:06:31 d4bequiet code-server[31942]: at VscodeProvider.<anonymous> (/usr/lib/code-server/out/node/vscode.js:198:30)
Jun 28 09:06:31 d4bequiet code-server[31942]: at step (/usr/lib/code-server/out/node/vscode.js:63:23)
Jun 28 09:06:31 d4bequiet code-server[31942]: at Object.next (/usr/lib/code-server/out/node/vscode.js:44:53)
Jun 28 09:06:31 d4bequiet code-server[31942]: at fulfilled (/usr/lib/code-server/out/node/vscode.js:35:58)
Jun 28 09:06:31 d4bequiet code-server[31942]: at processTicksAndRejections (internal/process/task_queues.js:97:5)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top GitHub Comments
keepalive
The shell expands tilde and environment variables but there’s nothing in the Node code that does the same.
Maybe we can call out to the shell so it can handle the expansions since there will be many edge cases.