Beispiel #1
0
 public MogglesToggleService(ICache cache, IMogglesFeatureToggleProvider featureToggleProvider, IMogglesLoggingService featureToggleLoggingService, IMogglesConfigurationManager mogglesConfigurationManager)
 {
     _cache = cache;
     _featureToggleProvider       = featureToggleProvider;
     _featureToggleLoggingService = featureToggleLoggingService;
     _mogglesConfigurationManager = mogglesConfigurationManager;
 }
        public FeatureToggleEnvironmentDetector(IMogglesLoggingService featureToggleLoggingService, IMogglesConfigurationManager mogglesConfigurationManager, IMogglesBusService busService)
        {
            _featureToggleLoggingService = featureToggleLoggingService;
            _mogglesConfigurationManager = mogglesConfigurationManager;
            _busService = busService;

            AddCustomAssembliesToAssembliesToIgnoreList();
        }
Beispiel #3
0
        public TelemetryClientService(IMogglesConfigurationManager mogglesConfigurationManager)
        {
            _mogglesConfigurationManager = mogglesConfigurationManager;
            var instrumentationKey = _mogglesConfigurationManager.GetInstrumentationKey();

            if (!string.IsNullOrEmpty(instrumentationKey))
            {
                _telemetryClient = new TelemetryClient(new TelemetryConfiguration(instrumentationKey));
            }
        }
Beispiel #4
0
        private void RegisterComponentsForNetCore(IConfiguration configuration, IMogglesLoggingService loggingService)
        {
            _mogglesConfigurationManager = new NetCoreMogglesConfigurationManager(configuration);
            MogglesContainer.Register(_mogglesConfigurationManager);

            ConfigureCommonComponents(loggingService);

            var cache = new NetCoreCache();

            _featureToggleService = new MogglesToggleService(cache, _featureToggleProvider, _featureToggleLoggingService, _mogglesConfigurationManager);
            MogglesContainer.Register(_featureToggleService);
        }
Beispiel #5
0
        public static Moggles ConfigureAndStartClient(IMogglesConfigurationManager configurationManager = null, IMogglesLoggingService loggingService = null)
        {
            lock (Padlock)
            {
                var instance = (Moggles)MogglesContainer.Resolve <Moggles>();
                if (instance == null)
                {
                    instance = new Moggles(configurationManager, loggingService);
                    MogglesContainer.Register(instance);
                }

                return(instance);
            }
        }
        public Task Consume(ConsumeContext <RefreshTogglesCache> context)
        {
            _featureToggleService        = (MogglesToggleService)MogglesContainer.Resolve <MogglesToggleService>();
            _featureToggleLoggingService = (IMogglesLoggingService)MogglesContainer.Resolve <IMogglesLoggingService>();
            _mogglesConfigurationManager = (IMogglesConfigurationManager)MogglesContainer.Resolve <IMogglesConfigurationManager>();

            var msg = context.Message;

            var currentApplication = _mogglesConfigurationManager.GetApplicationName();
            var currentEnvironment = _mogglesConfigurationManager.GetEnvironment();

            if (msg.ApplicationName.ToLowerInvariant() == currentApplication.ToLowerInvariant() &&
                msg.Environment.ToLowerInvariant() == currentEnvironment.ToLowerInvariant())
            {
                _featureToggleLoggingService.TrackEvent($"Handled cache refresh event for {msg.ApplicationName}/{msg.Environment}", currentApplication, currentEnvironment);
                _featureToggleService.CacheFeatureToggles();
            }

            return(Task.FromResult(0));
        }
 public NetCoreMogglesBusService(IMogglesConfigurationManager mogglesConfigurationManager)
 {
     _mogglesConfigurationManager = mogglesConfigurationManager;
 }
Beispiel #8
0
 private Moggles(IMogglesConfigurationManager configurationManager, IMogglesLoggingService loggingService)
 {
     RegisterComponentsForNetFull(configurationManager, loggingService);
     Init();
 }
Beispiel #9
0
        public static void ConfigureForTestingMode(IMogglesConfigurationManager configurationManager = null)
        {
            IMogglesConfigurationManager mogglesConfigurationManager = configurationManager ?? new NetFullMogglesConfigurationManager();

            MogglesContainer.Register(mogglesConfigurationManager);
        }
Beispiel #10
0
 public MogglesServerProvider(IMogglesLoggingService featureToggleLoggingService, IMogglesConfigurationManager mogglesConfigurationManager)
 {
     _featureToggleLoggingService = featureToggleLoggingService;
     _mogglesConfigurationManager = mogglesConfigurationManager;
 }