FakeDomeServer constructor

FakeDomeServer({
  1. String name = 'Fake dome',
  2. Map<String, (String, String)> users = const {'admin' : ('admin', 'admin'), 'operator' : ('operator', 'operator'), 'root' : ('root', 'superadmin')},
  3. bool allowAnonymousGuest = true,
  4. Duration accessTokenTtl = const Duration(minutes: 15),
  5. int heartbeatSec = 20,
})

Creates a fake with the given local users (username → (password, role)).

Implementation

FakeDomeServer({
  this.name = 'Fake dome',
  Map<String, (String, String)> users = const {
    'admin': ('admin', 'admin'),
    'operator': ('operator', 'operator'),
    'root': ('root', 'superadmin'),
  },
  this.allowAnonymousGuest = true,
  this.accessTokenTtl = const Duration(minutes: 15),
  this.heartbeatSec = 20,
}) : instanceId = uuidV7() {
  // Events of the active venue are also published under the alias `venues/default/…`.
  bus.alias = (t) {
    final d = _defaultVenue;
    if (d == null || d == 'default') return null;
    final prefix = 'venues/$d';
    if (t == prefix) return 'venues/default';
    return t.startsWith('$prefix/')
        ? 'venues/default/${t.substring(prefix.length + 1)}'
        : null;
  };
  users.forEach((u, v) {
    _users[u] = (v.$1, v.$2, uuidV7());
  });
  _gateways['osc'] = {
    'id': 'osc',
    'protocol': 'osc',
    'direction': 'outbound',
    'enabled': true,
    'status': 'up',
    'config': {
      'targets': ['lights'],
    },
  };
  _gateways['screenberry'] = {
    'id': 'screenberry',
    'protocol': 'screenberry-json',
    'direction': 'inbound',
    'enabled': false,
    'status': 'disabled',
    'config': <String, Object?>{},
  };
}