Skip to main content

Module startup

Module startup 

Source
Expand description

Startup shared by both binaries: the dashboard (eclipse-web) and the gateway (eclipse-gateway, which serves the same dashboard plus the /v1 API and the scheduled upgrade check).

Nothing here decides what to serve — only what config to load, which port to bind and what state the router gets. The routers are the binaries’ business.

Structs§

Options
What the command line said. Both binaries take the same flags.
Prepared
Everything a server needs before it can serve.

Constants§

MAX_TTL_HOURS
A year. A login that outlives the process is pointless — sessions live in memory — and a typo like session_ttl_hours = 999999 should not mint a cookie that never expires.
MIN_TOKEN_LEN
Shorter tokens are guessable; config init issues 64 hex characters (token::generate is 32 random bytes in hex), so this floor only ever bites a token typed by hand.

Functions§

auth_token
The login token the dashboard and the API share: one secret, no second credential to keep.
bind_addr
The dashboard is plain HTTP behind a single shared token, so it only binds to loopback addresses.
credentials
Who may sign in (#266): a username and a password hash from .env, or — on an install that has no hash yet — the shared token, which keeps working until eclipse web passwd runs.
dashboard_config
The config the dashboard serves: [web] default_profile decides which profile when the command line names none, resolved by loading again with it named so the overlay, session directories and plugins are exactly what a --profile run would get. An explicit --profile/ECLIPSE_PROFILE always wins.
prepare
Load the config, build the agent and the store, and decide the address. Shared by the dashboard and the gateway so the two can never disagree about what a profile means.
serve
Bind and serve until Ctrl-C. The router is the caller’s: the dashboard passes the dashboard router, the gateway passes the dashboard router with the API merged on.