Пример #1
0
        public async Task Invoke(CancellationToken cancellationToken)
        {
            var appConfig = new ExternalUrlsOptions();

            _config.GetSection("externalViews").Bind(appConfig);

            var urlViewSchema = await RemoteJsonFetch.GetRemoteJsonContentAsync(appConfig.UrlViewSchema);

            var remoteViewUrls = await GetRemoteUrlsAsync(appConfig.Urls, true);

            foreach (var url in remoteViewUrls.Urls)
            {
                await RemoteRazorLocationStore.LoadRemoteDataAsync(url, urlViewSchema);
            }
        }
        public async Task Invoke(CancellationToken cancellationToken)
        {
            var key           = "remote-static-esternal-spa";
            var currentHealth = await HealthCheckStore.GetHealthAsync(key);

            if (currentHealth == null)
            {
                currentHealth = new HealthRecord()
                {
                    Healty = false,
                    State  = null
                };
                await HealthCheckStore.SetHealthAsync(key, currentHealth);
            }

            var appConfig = new ExternalUrlsOptions();

            _config.GetSection("externalSPAConfigs").Bind(appConfig);

            var urlViewSchema = await RemoteJsonFetch.GetRemoteJsonContentAsync(appConfig.UrlViewSchema);

            var remoteViewUrls = await GetRemoteUrlsAsync(appConfig.Urls, true);

            var loaded = false;

            foreach (var url in remoteViewUrls.Urls)
            {
                loaded = await RemoteExternalSPAStore.LoadRemoteDataAsync(url);

                if (!loaded)
                {
                    logger.Fatal("Failed to load:{0}", url);
                    break;
                }
            }
            if (loaded && !currentHealth.Healty)
            {
                // once loaded we are good
                currentHealth = new HealthRecord()
                {
                    Healty = true,
                    State  = null
                };
                await HealthCheckStore.SetHealthAsync(key, currentHealth);
            }
        }