Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake base route output configurable #835
Comments
@tobilg Hey Tobi! Thanks for posting it! Are you're trying to override the |
@paveltiunov Basically I just want to hide that the endpoint is running Cube.js to external users. I know security by obscurity isn't the best idea, but ideally I'd like to give as litte info to potential attackers as possible. |
@tobilg We'd need to handle this |
How about the option for a base route message?, eg: const dbType = 'mysql';
const options = {
dbType,
devServer: false,
prodBaseUrlMsg: 'Nothing here',
logger: (msg, params) => {
console.log(`${msg}: ${JSON.stringify(params)}`);
},
schemaPath: path.join('assets', 'schema')
};
const core = CubejsServerCore.create(options); It could be assigned in the contstructor: this.logger = options.logger ||
(process.env.NODE_ENV !== 'production' ?
devLogger(process.env.CUBEJS_LOG_LEVEL) :
prodLogger(process.env.CUBEJS_LOG_LEVEL)
);
this.prodBaseUrlMessage = options.prodBaseUrlMessage || `Cube.js server is running in production mode. <a href="https://cube.dev/docs/deployment#production-mode">Learn more about production mode</a>.`
this.repository = new FileRepository(this.schemaPath); Then changes in async initApp(app) {
checkEnvForPlaceholders();
const apiGateway = this.apiGateway();
apiGateway.initApp(app);
if (this.options.devServer) {
this.devServer.initDevEnv(app);
} else {
app.get('/', (req, res) => {
res.status(200)
.send(`<html><body>${this.prodBaseUrlMessage}</body></html>`);
});
}
|
Hey so.... I don't even use Cube.js, and just decided it was a cool project and I'd try my hand at volunteering. Never really done that for OSS before. Is it normal in the world of OSS to dedicate a whole week night of your time, for free, to familiarizing yourself with a project, issue and propose a solution, only to be completely ignored, and have some other guy like @jcw- swoop in and piss all over your efforts? Because it sure is frustrating. I would have thought that whole "Showing empathy toward other community members" in your CoC would preclude something like that from happening. But, maybe I'm just new and all that empathy talk is lip service, and throwing away half a work day like that is normal in the jungle of OSS and I need to just suck it up. |
@KarateCowboy It is a cool project - you should also check out the Slack workspace! Thanks for taking the time to discuss approaches to this feature. I've also been thinking about ways to accomplish this and should have tagged you on the PR - I'm not sure if linking to the issue was enough to give you a notification. Even though your approach isn't the way I went in my PR, I did read and think about your suggestion and consider it a valuable contribution to the topic. Sorry for your frustration! Regarding your approach, here's some thoughts:
|
@jcw- Thank you for your input. It's good to know that my efforts produced some fruit, even if just food for someone else to consider in his approach. Also, thank you for your insights. I can now say I'm satisfied. |
Is your feature request related to a problem? Please describe.
It would be great to be able to configure the route output, e.g. I want to hide the
Cube.js server is running in production mode. Learn more about production mode.
when the base route is hitDescribe the solution you'd like
I think it would be great if one could configure the output of https://github.com/cube-js/cube.js/blob/master/packages/cubejs-server-core/core/index.js#L398 when the core server is instantiated.