Documentation
¶
Overview ¶
Command accountsd is experimental: its command-line interface may change in a minor release; see https://nsgo.games/docs/stability/.
Command accountsd runs the account service as a standalone HTTP server, with guest and email accounts in SQLite or Postgres.
accountsd init -config accounts.yaml -issuer https://accounts.example.com -audience my-game accountsd genkey -config accounts.yaml -key key.pem -keyset keys.yaml accountsd serve -config accounts.yaml -key key.pem -keyset keys.yaml -sqlite accounts.db -addr :8080 ACCOUNTS_POSTGRES_DSN=postgres://... accountsd serve -config accounts.yaml -key key.pem -keyset keys.yaml -postgres accountsd admin-token -config accounts.yaml -key key.pem -operator ci -ttl 24h
init writes a configuration with the default settings. genkey writes a new signing key and adds its public half to the key set file a game server verifies tokens with, keeping the keys already there; it replaces the key set file atomically, so a reader never sees half of it. Rotating a key is genkey with a new -key file, a restart on it once game servers have the new key set, and removing the old key from the key set once its tokens have expired. serve runs the service until SIGINT or SIGTERM; with -keyset it also accepts the tokens of every key in the key set and serves them at GET /v1/keys, so tokens signed before a rotation keep working on the service too. With metrics set in the configuration, serve also answers GET /healthz, GET /readyz (200 while the database answers a ping, else 503) and GET /metrics (Prometheus text: requests by route and status with latency, sign-ins and their failures, accounts and open sessions, and dropped audit records when admin is set) on that address, a listener of its own.
When the configuration has an admin: block, serve also runs the admin listener it describes (package admin) on its own address, for operators listed in its operators file; without the block no admin route exists. admin-token prints a bearer token for an operator of the operators file the admin: block names, or -operators names, signed with the service's key for the "admin" audience, which every service's admin listener accepts for as long as -ttl, the operator stays in the operators file and its tokensNotBefore is not moved past the token's issue time (game admin operator revoke-tokens).
Identity providers (Game Center, Play Games, Steam, OAuth) need their verifiers and platform credentials, so a game that links identities builds its own command around accounts.New with Options.Identities; this one serves guests and email accounts.