News for hackers. Stuff that matters.
Re:Show HN: Dashboard – self-hosted accounts, orgs and subsc... by benologist on Wednesday August 21, 2019 @12:13PM (#20758670)
This is implemented now, you can add a "before" request handler [1] and inspect the HOST header to check the domain and switch to an alternative configuration for that request. Dashboard compiles a global.packageJSON [2] holding your template, title, menu links etc and you can override that per-request by setting an alternative req.packageJSON for more individualized site settings too. Each of your application servers can serve a '/public/template-additional.css' and '/public/content-additional.css' to override the appearance as well.

    module.exports = {
        before: async (req) => {
            switch (req.host) {
                case 'domain1.com':
                    req.dashboardServer = 'domain1.com'
                    req.applicationServer = 'http://localhost:7000'
                    req.applicationServerToken = 'shared secret'
                    break
            }
        }
    } 
This will work with per-site user accounts because the data was already partitioned by the dashboard server address. I think for sharing accounts across multiple websites you could just omit changing the req.dashboardServer.

[1] https://userdashboard.github.io/request-handlers

[2] https://userdashboard.github.io/package-json

There are no comments on this comment yet.