dthree / dthree/vantage

Allow banner to be a function so banner can change depending on app state, or environment state

Open
#60 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
108
PR merge metrics
No merged PRs in 30d

Description

Currently, the banner is assigned on boot:

``` js
var banner =
"######################################################################" +
"# Welcome to joescrabshack.com #" +
"# #" +
"# All connections are monitored and recorded #" +
"# Disconnect IMMEDIATELY if you are not an authorized user #" +
"######################################################################";
vantage
.delimiter('appsvr:3000~$')
.banner(banner)
.listen(3000);
```

However this means that the context can only be when the banner was registered.

Instead, if the api could accept a banner, ie

``` js
vantage
.delimiter('appsvr:3000~$')
.banner(() => {
if (process.stdout.columns < 70){
return;
}
return banner;
})
.listen(3000);
```

Then the banner could be changed depending on the app state, or environment state. Some benefiting examples
- process.stdout.columns could be inspected to hide/resize wide banners (this currently only works if the same size shell as what booted the app in the first place is used)
- status of the running application could be returned, maybe a list of the last X exceptions
- Notifications that migrations need to be run
etc

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.