ServerCommand constructor

ServerCommand({
  1. required ArgResultsSource globals,
  2. required Map<String, String> environment,
  3. StringSink? out,
})

Creates the command.

Implementation

ServerCommand({
  required this.globals,
  required this.environment,
  StringSink? out,
}) : out = out ?? stdout {
  argParser
    ..addOption(
      'port',
      abbr: 'P',
      help: 'Port to listen on. 0 picks a free one.',
      defaultsTo: '8080',
    )
    ..addOption(
      'address',
      help: 'Address to bind. Defaults to every interface.',
      defaultsTo: '0.0.0.0',
    )
    ..addOption(
      'cors',
      help:
          'Comma-separated allowed origins for browser clients, or "*" for '
          'any.',
    )
    ..addOption(
      'publish-token',
      help:
          'Require this bearer token for every write. Reads stay open, so '
          'downloads and update checks keep working for anonymous clients. '
          r'Defaults to $OMNYSTORE_PUBLISH_TOKEN.',
    )
    ..addOption(
      'node-token',
      help:
          'Require this bearer token from storage nodes. Without it, any '
          'peer that can reach the control endpoint can claim to serve an '
          r'organization. Defaults to $OMNYSTORE_NODE_TOKEN.',
    )
    ..addFlag(
      'nodes',
      help: 'Accept storage nodes on the same port.',
      defaultsTo: true,
    )
    ..addOption(
      'node-mount',
      help: 'Path the storage-node control endpoint is mounted at.',
      defaultsTo: '/_node',
    )
    ..addOption('tls-cert', help: 'PEM certificate chain, to serve HTTPS.')
    ..addOption('tls-key', help: 'PEM private key, to serve HTTPS.')
    ..addOption(
      'provider-id',
      help: 'Id this server advertises for its own local provider.',
      defaultsTo: 'hub-local',
    );
}