Exemplo n.º 1
0
        public CollectionController(ILogger <CollectionController> logger,
                                    IFineCalculator fineCalculator, VehicleRegistrationService vehicleRegistrationService,
                                    DaprClient daprClient)
        {
            _logger                     = logger;
            _fineCalculator             = fineCalculator;
            _vehicleRegistrationService = vehicleRegistrationService;

            // set finecalculator component license-key
            if (_fineCalculatorLicenseKey == null)
            {
                bool runningInK8s = Convert.ToBoolean(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER") ?? "false");
                var  metadata     = new Dictionary <string, string> {
                    { "namespace", "dapr-trafficcontrol" }
                };
                if (runningInK8s)
                {
                    var k8sSecrets = daprClient.GetSecretAsync(
                        "kubernetes", "trafficcontrol-secrets", metadata).Result;
                    _fineCalculatorLicenseKey = k8sSecrets["finecalculator.licensekey"];
                }
                else
                {
                    var secrets = daprClient.GetSecretAsync(
                        "trafficcontrol-secrets", "finecalculator.licensekey", metadata).Result;
                    _fineCalculatorLicenseKey = secrets["finecalculator.licensekey"];
                }
            }
        }
        public CollectionController(ILogger <CollectionController> logger,
                                    IFineCalculator fineCalculator, VehicleRegistrationService vehicleRegistrationService)
        {
            _logger                     = logger;
            _fineCalculator             = fineCalculator;
            _vehicleRegistrationService = vehicleRegistrationService;

            // set finecalculator component license-key
            if (_fineCalculatorLicenseKey == null)
            {
                _fineCalculatorLicenseKey = "HX783-K2L7V-CRJ4A-5PN1G";
            }
        }
Exemplo n.º 3
0
        public CollectionController(ILogger <CollectionController> logger,
                                    IFineCalculator fineCalculator,
                                    VehicleRegistrationService vehicleRegistrationService,
                                    DaprClient daprClient)
        {
            _logger                     = logger;
            _fineCalculator             = fineCalculator;
            _vehicleRegistrationService = vehicleRegistrationService;

            // set finecalculator component license-key
            if (_fineCalculatorLicenseKey == null)
            {
                var secrets = daprClient.GetSecretAsync(
                    "trafficcontrol-secrets", "finecalculator.licensekey").Result;
                _fineCalculatorLicenseKey = secrets["finecalculator.licensekey"];
                // _fineCalculatorLicenseKey = "HX783-K2L7V-CRJ4A-5PN1G";
            }
        }