Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor config structure, objects, keys, and values #29

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 100 additions & 15 deletions next.config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,126 @@ const WebpackConfig = require('./webpack.config.js');
// eslint-disable-next-line no-undef
module.exports = {
publicRuntimeConfig: {
// @TODO could be name appName or appTitle (even though I like name the most)
name: '/spaces',
// @TODO array or object ???
// @TODO first is always default ???
authProviders: {
matrix: {
baseUrl: 'https://matrix.org',
allowCustomHomeserver: true,
// @TODO what's api for in /spaces, and where to define ???
// api: 'https://api.dev.medienhaus.udk-berlin.de',
allowCustomHomeserver: false,
},
// @TODO not affected by allowCustomHomeserver; should maybe be
// disabled / overwritten if custom homeserver is specified ???
// also the term (matrix) content storage is somewhat ambiguous
matrixContentStorage: {
baseUrl: 'https://second.matrixserver.org',
baseUrl: 'https://matrix.example.org',
},
etherpadMyPads: {
// @TODO i don't like the /mypads/api here
// (also see etherpad baseUrl below in line 74)
baseUrl: 'https://etherpad.example.org/mypads/api',
},
spacedeck: {
baseUrl: 'https://spacedeck.example.org',
},
},
serviceRoutes: {
account: {
enabled: true,
// @TODO i don't really like this option as it's basically matrix-only and not synced
// @TODO account management should probably be done in the auth provider (like ldap)
allowAddingNewEmails: false,
path: '/account',
},
dashboard: {
enabled: true,
bookmarks: true,
invites: true,
},
explore: {
enabled: true,
// @TODO can we please rename this key ???
contextRootSpaceRoomId: '!rnd...:matrix.org',
templates: {
context: [
'seminar',
],
item: [
// @TODO
// for each serviceRoutes.itemTemplate? ... {
// this.publicRuntimeConfig.serviceRoutes.element.template,
// this.publicRuntimeConfig.serviceRoutes.etherpad.template,
// this.publicRuntimeConfig.serviceRoutes.spacedeck.template,
// }
'studentproject',
],
},
},
element: {
enabled: true,
baseUrl: '//localhost/element',
path: '/chat',
template: 'chat-link',
},
etherpad: {
enabled: true,
// @TODO i don't like the /p here as it is important because
// ... it really depends on the etherpad nginx configuration
baseUrl: 'https://etherpad.example.org/p',
path: '/write',
baseUrl: 'https://pad.riseup.net/p',
myPads: {
api: 'http://etherpad.localhost/mypads/api',
spacesGroupName: '/spaces', // optional, defaults to publicRuntimeConfig.name

},
template: 'etherpad-link',
},
spacedeck: {
enabled: true,
baseUrl: 'https://spacedeck.example.org',
path: '/sketch',
template: 'spacedeck-link',
},
logout: {
// @NOTE in case someone wants this as signout or signoff or goodbye or whatever
path: '/logout',
},
},
contextRootSpaceRoomId: '!gB.....Ewlvdq:matrix.org',
account: {
allowAddingNewEmails: true,
localization: [
'en',
'de',
],
copyleft: {
hidden: false,
},
},
async rewrites() {
return [
{
rewrites() {
const rewriteConfig = [];

if (this.publicRuntimeConfig.authProviders.etherpad) {
rewriteConfig.push({
source: this.publicRuntimeConfig.authProviders.etherpad.path,
destination: '/etherpad',
},
{
source: this.publicRuntimeConfig.authProviders.etherpad.path + '/:roomId',
destination: '/etherpad/:roomId',
});
}

if (this.publicRuntimeConfig.authProviders.spacedeck) {
rewriteConfig.push({
source: this.publicRuntimeConfig.authProviders.spacedeck.path,
destination: '/spacedeck',
},
];
{
source: this.publicRuntimeConfig.authProviders.spacedeck.path + '/:roomId',
destination: '/spacedeck/:roomId',
});
}

// @TODO we'd need these for all serviceRoutes as well
// @TODO and probably independent of authProvider

return rewriteConfig;
},
webpack: WebpackConfig,
};