@@ -32,6 +32,7 @@ class IngestCommand : Command
3232 readonly BatchSizeFeature _batchSize ;
3333
3434 bool _quiet ;
35+ bool _setup ;
3536 int _simulations = 1 ;
3637
3738 public IngestCommand ( SeqConnectionFactory connectionFactory )
@@ -41,6 +42,7 @@ public IngestCommand(SeqConnectionFactory connectionFactory)
4142 _connection = Enable < ConnectionFeature > ( ) ;
4243
4344 Options . Add ( "quiet" , "Don't echo ingested events to `STDOUT`" , _ => _quiet = true ) ;
45+ Options . Add ( "setup" , "Configure sample dashboards, signals, users, and so on before starting ingestion" , _ => _setup = true ) ;
4446 Options . Add ( "simulations=" , "Number of concurrent simulations to run; the default runs a single simulation" ,
4547 v => _simulations = int . Parse ( v ) ) ;
4648
@@ -51,14 +53,27 @@ protected override async Task<int> Run()
5153 {
5254 var ( url , apiKey ) = _connectionFactory . GetConnectionDetails ( _connection ) ;
5355 var batchSize = _batchSize . Value ;
54-
55- if ( ! _confirm . TryConfirm ( $ "This will send sample events to the Seq server at { url } .") )
56- {
56+
57+ if ( ! _confirm . TryConfirm ( _setup
58+ ? $ "This will apply sample configuration and send sample events to the Seq server at { url } ."
59+ : $ "This will send sample events to the Seq server at { url } ."
60+ ) ) {
5761 await Console . Error . WriteLineAsync ( "Canceled by user." ) ;
5862 return 1 ;
5963 }
6064
6165 var connection = _connectionFactory . Connect ( _connection ) ;
66+
67+ if ( _setup )
68+ {
69+ var setupResult = await SetupCommand . ImportTemplates ( connection ) ;
70+
71+ if ( setupResult != 0 )
72+ {
73+ return setupResult ;
74+ }
75+ }
76+
6277 var simulations = Enumerable . Range ( 0 , _simulations )
6378 . Select ( _ => Simulation . RunAsync ( connection , apiKey , batchSize , echoToStdout : ! _quiet ) )
6479 . ToList ( ) ;
0 commit comments