Skip to content

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

@zakhenry

Description

@zakhenry

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions