Skip to content

Commit

Permalink
refactor config structure, objects, keys, and values
Browse files Browse the repository at this point in the history
  • Loading branch information
andirueckel committed Jul 26, 2023
1 parent 5129beb commit 49ad59b
Showing 1 changed file with 100 additions and 16 deletions.
116 changes: 100 additions & 16 deletions next.config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,125 @@ 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',
});
}
*/

return rewriteConfig;
},
webpack: WebpackConfig,
};

0 comments on commit 49ad59b

Please sign in to comment.