blob: 272de2523b3b9f772afbec0d7bc73272c1258682 [file] [log] [blame]
#!/usr/bin/env dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:convert';
import 'dart:io';
import 'package:args/args.dart';
import 'package:symbolizer/model.dart';
final parser = ArgParser()
help: 'GitHub OAuth token',
defaultsTo: Platform.environment['GITHUB_TOKEN'])
help: 'SendGrid API token',
defaultsTo: Platform.environment['SENDGRID_TOKEN'])
help: 'Email for failure reports',
defaultsTo: Platform.environment['FAILURE_EMAIL'])
..addOption('output', help: 'Config to write', defaultsTo: '.config.json');
void main(List<String> args) {
final opts = parser.parse(args);
for (var opt in ['github-token', 'sendgrid-token', 'failure-email']) {
if (opts[opt].isEmpty) {
throw 'Pass non-empty value via --$opt or through'
' ${opt.toUpperCase().replaceAll('-', '_')} environment variable';
final config = ServerConfig(
githubToken: opts['github-token'],
sendgridToken: opts['sendgrid-token'],
failureEmail: opts['failure-email'],