Generate config
This commit is contained in:
parent
7de0dfe749
commit
b8d3156b53
7 changed files with 139 additions and 5 deletions
|
|
@ -67,9 +67,12 @@
|
|||
file:
|
||||
path: /var/opt/kanidm_data
|
||||
state: directory
|
||||
# - name: Generate Element Web config
|
||||
# # run on localhost
|
||||
# local_action: ansible.builtin.command cd ../element-web && node config.js
|
||||
- name: Copy Element Web config
|
||||
ansible.posix.synchronize:
|
||||
src: ../element-web/
|
||||
src: ../element-web/public/
|
||||
dest: /etc/element-web
|
||||
- name: Copy homepage config
|
||||
ansible.posix.synchronize:
|
||||
|
|
|
|||
46
servers/element-web/config.js
Normal file
46
servers/element-web/config.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import fs from 'node:fs';
|
||||
// Read base config
|
||||
const baseConfig = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
|
||||
// Server list
|
||||
const servers = JSON.parse(fs.readFileSync('./servers.json', 'utf8'));
|
||||
// Default server config
|
||||
const defaultServerConfig = "element.ellis.link";
|
||||
const defaultConfigPath = './public/config.json';
|
||||
|
||||
// biome-ignore lint/complexity/noForEach: <explanation>
|
||||
Object.keys(servers).forEach(server => {
|
||||
// Get server config
|
||||
const serverConfig = servers[server];
|
||||
// Create overridden config
|
||||
const overriddenConfig = {
|
||||
...baseConfig,
|
||||
default_server_name: serverConfig.serverName,
|
||||
default_server_config: {
|
||||
...baseConfig?.default_server_config,
|
||||
"m.homeserver": {
|
||||
...baseConfig.default_server_config["m.homeserver"],
|
||||
base_url: serverConfig.baseUrl
|
||||
},
|
||||
"org.matrix.msc3575.proxy": {
|
||||
...baseConfig.default_server_config["org.matrix.msc3575.proxy"],
|
||||
url: serverConfig.baseUrl
|
||||
}
|
||||
},
|
||||
room_directory: {
|
||||
...baseConfig.room_directory,
|
||||
servers: [
|
||||
serverConfig.serverName,
|
||||
...baseConfig.room_directory.servers.filter(s => s !== serverConfig.serverName)
|
||||
]
|
||||
}
|
||||
};
|
||||
// Write config
|
||||
const configPath = `./public/config.${server}.json`;
|
||||
console.log(`Writing config to ${configPath}`);
|
||||
fs.writeFileSync(configPath, JSON.stringify(overriddenConfig, null, 4));
|
||||
// write default config
|
||||
if (server === defaultServerConfig) {
|
||||
console.log(`Writing default config to ${defaultConfigPath}`);
|
||||
fs.writeFileSync(defaultConfigPath, JSON.stringify(overriddenConfig, null, 4));
|
||||
}
|
||||
});
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"default_server_name": "ellis.link",
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": "https://matrix.ellis.link/"
|
||||
},
|
||||
"org.matrix.msc3575.proxy": {
|
||||
"url": "https://matrix.ellis.link/"
|
||||
},
|
||||
"m.identity_server": {
|
||||
"base_url": "https://vector.im"
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
"show_labs_settings": true,
|
||||
"room_directory": {
|
||||
"servers": [
|
||||
"ellis.link",
|
||||
"pissing.dev",
|
||||
"ellis.link",
|
||||
"matrix.org",
|
||||
"mozilla.org",
|
||||
"maunium.net",
|
||||
76
servers/element-web/public/config.json
Normal file
76
servers/element-web/public/config.json
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"default_server_name": "ellis.link",
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": "https://matrix.ellis.link/"
|
||||
},
|
||||
"org.matrix.msc3575.proxy": {
|
||||
"url": "https://matrix.ellis.link/"
|
||||
},
|
||||
"m.identity_server": {
|
||||
"base_url": "https://vector.im"
|
||||
}
|
||||
},
|
||||
"brand": "Element",
|
||||
"integrations_ui_url": "https://scalar.vector.im/",
|
||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||
"integrations_widgets_urls": [
|
||||
"https://scalar.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar.vector.im/api",
|
||||
"https://scalar-staging.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar-staging.vector.im/api",
|
||||
"https://scalar-staging.riot.im/scalar/api"
|
||||
],
|
||||
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
|
||||
"uisi_autorageshake_app": "element-auto-uisi",
|
||||
"show_labs_settings": true,
|
||||
"room_directory": {
|
||||
"servers": [
|
||||
"ellis.link",
|
||||
"pissing.dev",
|
||||
"matrix.org",
|
||||
"mozilla.org",
|
||||
"maunium.net",
|
||||
"gitter.im",
|
||||
"kde.org",
|
||||
"libera.chat",
|
||||
"schildi.chat",
|
||||
"raim.ist"
|
||||
]
|
||||
},
|
||||
"enable_presence_by_hs_url": {
|
||||
"https://matrix.org": false,
|
||||
"https://matrix-client.matrix.org": false,
|
||||
"https://matrix.ellis.link": true,
|
||||
"https://ellis.link": true,
|
||||
"https://matrix.pissing.dev": true,
|
||||
"https://pissing.dev": true
|
||||
},
|
||||
"terms_and_conditions_links": [
|
||||
{
|
||||
"url": "https://element.io/privacy",
|
||||
"text": "Privacy Policy (Element)"
|
||||
},
|
||||
{
|
||||
"url": "https://element.io/cookie-policy",
|
||||
"text": "Cookie Policy (Element)"
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"threadsActivityCentre": true,
|
||||
"feature_video_rooms": true,
|
||||
"feature_group_calls": true,
|
||||
"feature_element_call_video_rooms": true,
|
||||
"feature_latex_maths": true,
|
||||
"feature_bridge_state": true,
|
||||
"feature_render_reaction_images": true
|
||||
},
|
||||
"setting_defaults": {
|
||||
"RustCrypto.staged_rollout_percent": 100,
|
||||
"Registration.mobileRegistrationHelper": true
|
||||
},
|
||||
"element_call": {
|
||||
"url": "https://call.element.dev"
|
||||
},
|
||||
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
|
||||
}
|
||||
12
servers/element-web/servers.json
Normal file
12
servers/element-web/servers.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"element.ellis.link": {
|
||||
"elementUrl": "https://element.ellis.link/",
|
||||
"baseUrl": "https://matrix.ellis.link/",
|
||||
"serverName": "ellis.link"
|
||||
},
|
||||
"element.pissing.dev": {
|
||||
"elementUrl": "https://element.pissing.dev/",
|
||||
"baseUrl": "https://matrix.pissing.dev/",
|
||||
"serverName": "pissing.dev"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue