mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-04-26 01:35:54 +03:00
[GH-ISSUE #1607] Strange behavior between .env and config.json for websocket activation #1013
Labels
No labels
SSO
Third party
better for forum
bug
bug
documentation
duplicate
enhancement
future Vault
future Vault
future Vault
good first issue
help wanted
low priority
notes
pull-request
question
troubleshooting
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vaultwarden#1013
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sebtiz13 on GitHub (Apr 13, 2021).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1607
Subject of the issue
I have strange behavior between .env and config.json for websocket activation.
I need to add
"websocket_enabled": true"in config.json for websocket synchronisation work with firefox extension (I haven't check other browser extension)Deployment environment
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
In doubt this is my .env
Steps to reproduce
When I have set
WEBSOCKET_ENABLED="true"in.envthe connection to websocket in web_vault work normally but doesn't have websocket synchronization with my firefox extensionIf i edit the
config.jsonfile manually to add"websocket_enabled": true"after restart of service and manually synchronization in firefox extension the websocket synchronization with my firefox extension workExpected behaviour
Work normally with just
.envvariables or when update configuration with admin page don't remove "websocket_enabled" inconfig.jsonActual behaviour
The Firefox extension don't receive websocket synchronization if "websocket_enabled" is not in
config.jsonand update on configuration page overwrite theconfig.jsonwithout "websocket_enabled"Troubleshooting data
In my console with webvault
Sorry i don't find how show eventually error of websocket in firefox extension
@BlackDex commented on GitHub (Apr 13, 2021):
This is how it works.
You probably have toggled the websockets setting within the admin interface, which saves the settings to the json file.
The json file overrules the env settings.
@jjlin commented on GitHub (Apr 13, 2021):
websocket_enabledis read-only config, though. It shouldn't be editable via the admin interface, or saved to config.json. But I'm not sure what happens if you manually edit config.json with a conflicting value.@BlackDex commented on GitHub (Apr 13, 2021):
Hmm indeed. I'm also not sure if it gets saved to the json file, if that is the case, that should be fixed.
@sebtiz13 commented on GitHub (Apr 14, 2021):
Sorry, indeed I had trouble to really explaining the behavior.
Like say @jjlin the
websocket_enabledits read-only configuration on admin, so it's not saved inconfig.json. This is why when update configuration on admin theconfig.jsonit's override withoutwebsocket_enabled.This behavior seems logical to me, but what I don't understand its why when I set
WEBSOCKET_ENABLED="true"only in .env its appear like enabled on admin page but doesn't work with Firefox extension and when I edit manuallyconfig.jsonto add"websocket_enabled": trueafter restart it's work.I suppose there is a part of code where the parameter
websocket_enabledit's only get fromconfig.jsonand don't support environment variable.That I found strange, it's
web_vaultsent to consoleWebSocket connectedin two case (environment variable and manually add in config.json) but if parameter it's not set inconfig.jsonit's like websocket server are enabled, but not send synchronization messageIn doubt, I add my dot env in original message
@BlackDex commented on GitHub (Jun 20, 2021):
@sebtiz13:
There is no way that the env's arn't read and the config.json is. They are getting merged.
So, there are a few options here i think.
Best way to check this out is by renaming the
config.jsonfile temporarily toconfig.json.oldor something.Change the .env file var
LOG_LEVELto either havetracelogging or no logging,off, at all, to see if it picks up that change, and maybe verify that by going to the /admin and check the settings over there.If it does change the logging output, then i would suggest to move that variable
LOG_LEVELall the way at the bottom, and remove it from the previous place and see if it still works. If it breaks, then something is going wrong down the line in the file for some reason.Same goes for the
WEBSOCKET_ENABLEDvar, you could try to put that all the way at the top of the.envfile and see what happens. If it then does start to work, then also there is something strange within the.envfile which i really would like to know what, so that we can try to detect it, and prevent issues for the rest.In any case, you should at least see something like this when it started:
So, could you provide us with this info please?
@sebtiz13 commented on GitHub (Jun 22, 2021):
Hello
I have finally found the cause of this behavior.
It's due too comment after the value
# enable websocketI have configured my server with systemd like example from wiki page Setup as a systemd service i have declared my
.envlike thisand all env variables are loaded except "WEBSOCKET_ENABLED" it's due to the comment after the variables
I don't really understand why but when I start the server from bash with
It's read, but with systemd not, i supose it's an error to have an comment on same line as a variable in
.envfor systemd (maybe not use same parser like bash)Finally i have remove the comment and it's work normally
And effectively if i keep
"websocket_enabled": truein config.json on start i have this warningSo maybe just need to add an comment for this details on wiki
Thanks for your help
@BlackDex commented on GitHub (Jun 23, 2021):
@sebtiz13 feel free to update the wiki!