Pull conf.yml from server

This commit is contained in:
aterox
2022-03-05 01:22:12 -05:00
parent df3e8e6f13
commit aeec449dc7
5 changed files with 32 additions and 3 deletions

View File

@@ -27,6 +27,7 @@ const rebuild = require('./services/rebuild-app'); // A script to programmatical
const systemInfo = require('./services/system-info'); // Basic system info, for resource widget
const sslServer = require('./services/ssl-server'); // TLS-enabled web server
const corsProxy = require('./services/cors-proxy'); // Enables API requests to CORS-blocked services
const getConf = require('./services/get-conf'); // Returns the configuration as a JSON object
/* Helper functions, and default config */
const printMessage = require('./services/print-message'); // Function to print welcome msg on start
@@ -116,6 +117,14 @@ const app = express()
} catch (e) {
res.end(JSON.stringify({ success: false, message: e }));
}
})
// GET endpoint returns the app configuration
.use(ENDPOINTS.getConf, (req, res) => {
try {
res.end(JSON.stringify(getConf()));
} catch (e) {
res.end(JSON.stringify({ success: false, message: e }));
}
});
/* Create HTTP server from app on port, and print welcome message */