/// <summary> /// 注入Cissy配置 /// </summary> /// <param name="services"></param> /// <returns></returns> public static CissyConfigBuilder AddCissyConfig(this IServiceCollection services, AppRunStatus runState) { appRunStatus = runState; ServiceCollection = services; CissyConfig config = GetCissyConfig(); if (config.IsNotNull()) { services.AddSingleton(typeof(ICissyConfig), config); } return(new CissyConfigBuilder() { ServiceCollection = services, CissyConfig = config }); }
public static CissyConfigBuilder AddCissyRemoteConfig(this IServiceCollection services, RemoteConfigSource remoteConfigSource) { appRunStatus = remoteConfigSource.RunStatus; ServiceCollection = services; var ConfigUrl = $"{remoteConfigSource.ConfigServer}/api/{remoteConfigSource.Version}/appconfig/index?appname={remoteConfigSource.AppName}&configpwd={remoteConfigSource.Password}&r={new Random().Next (1000,9999)}"; CissyConfig config = GetCissyRemoteConfig(ConfigUrl); if (config.IsNotNull()) { services.AddSingleton(typeof(ICissyConfig), config); } return(new CissyConfigBuilder() { ServiceCollection = services, CissyConfig = config }); }