Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zakhenry opened this issue Jun 5, 2016 · 0 comments

Comments

@zakhenry
Copy link
Contributor

zakhenry commented Jun 5, 2016

Currently, the banner is assigned on boot:

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant