0.0.6 • Published 5 months ago

@eth-optimism/utils-app v0.0.6

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

Utils-App

A general framework for creating typescript applications.

  • Handles application lifecycle
  • Metrics server configuration
  • CLI configuration

Configuration

A set of default options are provided to every instance of App.

--log-level <level>                     Set log level (choices: "debug", "info", "warn", "error", "silent", default: "debug", env: LOG_LEVEL)
--admin-enabled                         Enable admin API server (default: false, env: ADMIN_ENABLED)
--admin-port <port>                     Port for admin API (default: "9000", env: ADMIN_PORT)
--metrics-enabled                       Enable metrics collection (default: false, env: METRICS_ENABLED)
--metrics-port <port>                   Port for metrics server (default: "7300", env: METRICS_PORT)
  • The Hono admin api, logger, and all commander options are available as properties on App.

  • An overridable method on App is available, protected additionalOptions(): []Options, used to specify any additional cli options needed.

  • If enabled, the metrics server emits metrics under the /metrics path.

Lifecycle

The application lifecycle follows

  1. preMain(): validate options and admin api registration prior to running app
  2. main(): implementation of app logic
  3. shutdown() : triggered on interruption or executed after the return of main
    • This MUST cause the resolution of the main promise in order for graceful shutdown. After the 5th interruption, the process is forcefully exited.
0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago