System-wide config.json for riot-desktop
I am trying to set the default URL for the desktop client on Mac. As far as I can understand from the documentation at https://github.com/vector-im/riot-web/blob/master/docs/config.md#desktop-app-configuration I should be able to put a file at ~/Library/Application Support/Riot/config.json, containing the following:
{
"default_server_name": "staffchat.myserver.com",
}
However, this does not seem to achieve my goal. The URL offered at sign in is still https://matrix-client.matrix.org. I suspect that I am misunderstanding the documentation, or that it is incorrect or lacking the required information.
Describe the solution you'd like
I would like clear documentation on how config.json should be used, and where is should/can be saved.
Describe alternatives you've considered
Note that I have also tried this location, as this would be more useful for a managed Mac to apply to all users:
/Library/Application Support/Riot/config.json
This also had no effect.
Additional context The idea solution would be that a Configuration Profile could be deployed in order to apply settings on Mac clients. This is the well established and well-documented method for applying settings to Mac applications, and would be required if you ever wished to deploy the application via the Mac App Store.
You've understood everything about the location of the file correctly, the problem is you have created an invalid JSON file. The trailing comma is not allowed in JSON, remove that and it should work properly.
@aaronraimist Thanks that did work, but only when placed in ~/Library/Application Support/Riot/config.json - it doesn't look at /Library/Application Support/Riot/config.json.
Most Mac apps have a hierarchy of settings so that they can be globally administered:
- Configuration Profile deployed by MDM.
- Global Preference file placed in
/Library/Preferences, for example/Library/Preferences/im.riot.app.plist. - User preference file placed in
~/Library/Preferences, for example~/Library/Preferences/im.riot.app.plist.
For those apps that have not adopted the above standard method, there is still normally a method to deploy global standards, for example in /Library/Application Support/Riot/config.json or occasionally within the application bundle, e.g. /Applications/Riot.app/Contents/Resources/config.json.
Are there any opportunities to supply global settings? Per-user settings do not deploy well on Mac, especially from macOS 10.15 Catalina onwards, where User folders are protected.
For info, Mozilla have recently added the opportunity to supply settings for Firefox via Config Profile along with the config.json method.
Its based on https://www.electronjs.org/docs/api/app#appgetpathname which is ~/Library/Application Support/...
Ah yes, there is a long-standing plea by Mac Admins to get Electron to properly support global configurations.
So to clarify, you want a Third config?
- build config, shipped inside the asar archive
- (new) installation config, somewhere near the install path
- profile config, specified by the user as per https://github.com/vector-im/riot-desktop#user-specified-configjson
@t3chguy something like that, yes. As I said, most Mac applications provide the ability to set global settings which take precedence over user-specific settings, so that administrators can pre-define certain settings, such as whether the user should be able to search for and download updates, or to predefine server settings for everyone who will use the computer.
I'm aware that most electron apps often don't adhere as well to the standards for Mac as described in my post on March 19, but many still provide some option to set configuration for all users via a config.json outside of the user folders. Something along those lines would be great!
Same Problem on Linux with the debian packages. Until now, I was overwriting /opt/Riot/resources/webapp/config.json with a custom one after every riot-web package update. So my clients where having the correct default home/identity server setup. Since the update to 1.6.3 this file is ignored so I had to create a ~/.config/Riot/config.json for every single user in their home directory, which is not very practical to deploy changes in the config. I would really love to see a config.json for system config, which is not overwritten by the package updates too :)
The internal move to https://github.com/vector-im/riot-desktop in 1.6 is what changed the internal structure, its not as new as 1.6.3.
@airblag just out of interest, would you prefer it in /etc/riot-desktop/config.json or is /opt/riot-desktop/config.json fine too?
The internal move to https://github.com/vector-im/riot-desktop in 1.6 is what changed the internal structure, its not as new as 1.6.3.
Yeah, I blocked the update until I found a solution for this, that why I first tried with 1.6.3
@airblag just out of interest, would you prefer it in
/etc/riot-desktop/config.jsonor is/opt/riot-desktop/config.jsonfine too?
If it's not overwritten by the package update, I don't really care where is it. But /etc/riot-desktop is a nice place I would think.
Has there been a change in the config.json syntax with the move to Element (Riot).app? Our existing method of pre-creating the file at $HOME/Library/Application Support/Riot/config.json no longer picks up the settings now that I'm installing Element (Riot).app, and if I create the file at $HOME/Library/Application Support/Element/config.json, it results in an error message at start up. There is also no effect if I put the file in $HOME/Library/Application Support/Element (Riot)/config.json, though this folder is created on startup.
Also, any progress with the idea of a global config file at /Library/Application Support/Element/config.json (or whichever folder will become the default..!)?
+1 for this one. Run into a trouble situation while upgrading from Riot to Element on Windows Terminal Server 2016.
- Element should exist only 1 time on these servers, e..g. in Program Files (x86)\Element
- All users on the TS starts Element from there
- There should e a system wide config.json on this folder to change HS and disable auto update
- Normal users never should start checking for updates
Currently TS setup of Element is fully manual.
I'm kind of still waiting for this feature to update my linux workstations from riot 1.6.3 to Element, since I don't wanna create the config.json in the home of my users, and I need them to connect to our matrix server as default. Any chance of seeing it soon ?
Same Problem on Linux with the debian packages. Until now, I was overwriting /opt/Riot/resources/webapp/config.json with a custom one after every riot-web package update. So my clients where having the correct default home/identity server setup. Since the update to 1.6.3 this file is ignored so I had to create a ~/.config/Riot/config.json for every single user in their home directory, which is not very practical to deploy changes in the config. I would really love to see a config.json for system config, which is not overwritten by the package updates too :)
I'm still trying to enable labs creating ~/.config/Element/config.json, which Element mentions on the startup as the config dir, but it won't read it. In fact I even failed to find the default config, can you give me a hand here @airblag ?
The default config is packaged inside a file called app.asar - it'd be something like https://github.com/vector-im/element-desktop/blob/develop/element.io/release/config.json
@t3chguy thanks, in my case (Ubuntu 20.04) there are
/opt/Element/resources/app.asar
The first one being an archive and I didn't find how to effectively edit it.
/opt/Element/resources/app.asar.unpacked/
└── node_modules
└── gifwrap
├── LICENSE
├── package.json
├── src
│ ├── bitmapimage.js
│ ├── gifcodec.js
│ ├── gifframe.js
│ ├── gif.js
│ ├── gifutil.js
│ └── index.js
└── templates
└── README.hbs
The second one is unpacked and has no such settings :/
You would need to use https://github.com/electron/asar to unpack it.
@t3chguy yeah, I managed. Nothin like config.json inside.
Even reinstallation did not help.
How to define which config file if uses, it clearly seems like it's somewhere else.
What's inside the asar then? Element needs a config.json file to function
@t3chguy
the tree output is too big, could find only these:
fd config.json 3197ms Mi 14 Apr 2021 20:03:37 UTC
app.asar.unpacked2/node_modules/@jimp/custom/types/tsconfig.json
app.asar.unpacked2/node_modules/atomically/tsconfig.json
app.asar.unpacked2/node_modules/image-q/demo/html/src/tsconfig.json
app.asar.unpacked2/node_modules/image-q/src/tsconfig.json
app.asar.unpacked2/node_modules/jimp/types/ts3.1/tsconfig.json
app.asar.unpacked2/node_modules/jimp/types/tsconfig.json
app.asar.unpacked2/node_modules/timm/tsconfig.json
app.asar.unpacked2/node_modules/uri-js/tsconfig.json
Still, grepping for settings from https://github.com/vector-im/element-desktop/blob/develop/element.io/release/config.json does return only some of then in the js code, not jsons.
OK, I've managed to make it work. element-desktop didn't warn/error that config.json's syntax is wrong. Or I just don't know how to enable the verbose logs.
Short manual:
- in order to find where your
element-desktopstores the data, run it from the terminal, first two lines of output will be about/home/$USER/.config/Element exists: yes /home/$USER/.config/Riot exists: no - Copy over the default config into
/home/$USER/.config/Element /config.json - If the syntax is correct, you'll see the changes in the settings, I found it easy to flag
"showLabsSettings": true,so it's seen in the settings right away.
Is it possible now to add a System-wide config.json for Element in Debian based distribution by adding it to /opt/Element/resources/config.json or /opt/Element/config.json ? Doesn't seem like working...
No, given that this issue is still Open.
Believe solved by https://github.com/element-hq/element-desktop/pull/1921
It is not, as you would need to inject an envvar or cli argument, which you cannot do on the default shortcuts/desktop files without the updater then nuking them. This issue asked for checking a standard path e.g. /etc/element-desktop/config.json
Wrongly closed due to action misconfiguration