refactor: Change Configuration.initialize to be async

Tweak SparkCoreServices to synchronize Configuration.init globally
This commit is contained in:
John Colvin committed 2025-12-30 11:42:20 -05:00
1 parent be2368f95a
commit 3a6141f3ae
37 files changed
+762 -323

No files matched your search

+7 -3
View File
@@ -10,6 +10,8 @@
using CommandLine;
using Spark.Api.Server;
using Spark.Api.Services;
using Spark.Core.Services;
using System;
using System.Reactive.Linq;
@@ -39,11 +41,13 @@
Log.notnull(opts.user);
Log.notnull(opts.password);
PubSubConfig.SetGlobalConfig(Log.notnull(opts.PubSub));
var service_ctx = ServiceContext.create(opts.sparkd);
await service_ctx.login(opts.user, opts.password);
var serviceCtx = new ServiceContext(new SparkConfigLoader(new SparkConfigLoaderOpts() { ConfigServer = opts.sparkd } ));
var loginService = new SparkdLoginService(serviceCtx, new SparkApiCredentials() { User = opts.user, Password = opts.password });
await loginService.LoginAsync();
PrimitiveManager.SetMarketDataClient(new MarketDataClient(new(TimeSpan.FromSeconds(0.5))));
var sync = new bts.websocket_core.WebsocketDataSync(service_ctx);
var userDataPermissions = new UserDataPermissions(loginService);
var sync = new bts.websocket_core.WebsocketDataSync(serviceCtx, userDataPermissions);
var gwy = new bts.websocket_core.WebsocketConnectionGateway();
var prms = new WebsocketServerConfig {
DefaultEndPoint = "/",