string ISecureConfigurationStore.Store(string name, IConfigurationValue value)
        {
            var secret = Secrets.FirstOrDefault(s => s.Name == name);

            if (!ReferenceEquals(secret, null))
            {
                if (!Equals(secret.Value, value))
                {
                    throw new InvalidOperationException();
                }
            }
            else
            {
                secret = new KeyVaultSecret {
                    Name = name, Value = value
                };
                Secrets.Add(new KeyVaultSecret {
                    Name = name, Value = value
                });
            }

            var secretResourceId = $"resourceId('Microsoft.KeyVault/vaults/secrets', '{Name}', '{secret.Name}')";

            return($"[concat('@Microsoft.KeyVault(SecretUri=', reference({secretResourceId}).secretUriWithVersion, ')')]");
        }
示例#2
0
        /// <param name="pinfo">info of property to work with</param>
        /// <param name="config">configuration containing the instance to set to</param>
        public PropertyRequirement(PropertyInfo pinfo, IRequiresConfiguration config)
        {
            this.propertyInfo   = pinfo;
            this.configuration  = config;
            this.type           = pinfo.PropertyType.FullName;
            this.name           = pinfo.Name;
            this.valueTypesOnly = pinfo.PropertyType.IsValueType;
            this.hard           = false;

            foreach (Attribute attr in pinfo.GetCustomAttributes(true))
            {
                if (attr is RequiredAttribute)
                {
                    this.hard = true;
                }
                if (attr is DefaultClassAttribute)
                {
                    this.defaultValue = new ProviderValue(
                        new ConfiguredComponent((attr as DefaultClassAttribute).ClassName));
                }
                if (attr is DefaultNameAttribute)
                {
                    this.defaultValue = new ComponentRef("${" + (attr as DefaultNameAttribute).ComponentName + "}");
                }
            }
        }
        void IConfigurable.Configure(string name, IConfigurationValue value)
        {
            if (value.ShouldBeStoredSecure)
            {
                var type = ConnectionStringType.Custom;
                if (value is CosmosDocumentDatabaseAccessKey)
                {
                    type = ConnectionStringType.DocDb;
                }
                if (value is ServiceBusConnectionString)
                {
                    type = ConnectionStringType.ServiceBus;
                }

                ConnectionStrings.Add(new AppServiceConnectionString
                {
                    Name  = name,
                    Type  = type.ToString(),
                    Value = value
                });
            }
            else
            {
                Settings.Add(new AppServiceSetting(name, value));
            }

            MoveSettingsIntoStore();
        }
示例#4
0
        public void Set(IConfigurationValue value)
        {
            using var context = new DatabaseContext(Options.Options);
            var entity = context.ConfigurationValues
                         .SingleOrDefault(v => v.Guid == value.Guid);

            if (entity == null)
            {
                return;
            }
            entity.Value = value.Value.AsConfigurationStringValue();
            context.Entry(entity).State = EntityState.Modified;
            context.SaveChanges();
        }
        public static IConfigurationValueResolver GetResolverFor(this TinyIoC.TinyIoCContainer ioc,
                                                                 IConfigurationValue value)
        {
            var resolverType = typeof(IConfigurationValueResolver <>).MakeGenericType(value.GetType());

            try
            {
                var resolver = ioc.Resolve(resolverType);
                return((IConfigurationValueResolver)resolver);
            }
            catch (TinyIoCResolutionException e)
            {
                Console.WriteLine(e);
                return(null);

                throw;
            }
        }
 public void UpdateValue(IConfigurationValue newValue)
 {
     this.CollectionStore.UpdateValue(newValue);
 }
 public void UpdateValue(IConfigurationValue value) => this.UpdateValue(value.Guid, value.Value);
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfiguratioValueDecorator"/> class.
 /// </summary>
 /// <param name="inner">The inner.</param>
 public ConfiguratioValueDecorator(IConfigurationValue inner)
 {
     this._Inner = inner;
 }
 public void Initialize(IAppSettings appSettings, IEvaluateConfiguration configurationEvaluator)
 {
     Name = new ConfigurationValue(appSettings, configurationEvaluator, "TeamName", "Name");
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ForceDirectoryValueDecorator"/> class.
 /// </summary>
 /// <param name="inner">The inner.</param>
 public ForceDirectoryValueDecorator(IConfigurationValue inner)
     : base(inner)
 {
 }
 public AppServiceSetting(string name, IConfigurationValue value)
 {
     Name  = name;
     Value = value;
 }
示例#12
0
 /// <summary>
 /// Constructor from an array of configuration values
 /// </summary>
 /// <param name="description"></param>
 public ConfigurationDescription(IConfigurationValue[] description)
 {
     m_configuration = new List<IConfigurationValue>(description);
     BuildMapping();
 }
 Task <object> IConfigurationValueResolver.Resolve(IConfigurationValue value)
 {
     return(Resolve((TValue)value));
 }
        bool IConfigurationValueResolver.CanResolve(IConfigurationValue value)
        {
            var v = value as TValue;

            return(v != null && CanResolve(v));
        }
 public Task UpdateValueAsync(IConfigurationValue newValue)
 {
     return(this.CollectionStore.UpdateValueAsync(newValue));
 }
示例#16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequiredValueDecorator"/> class.
 /// </summary>
 /// <param name="inner">The inner.</param>
 public RequiredValueDecorator(IConfigurationValue inner)
     : base(inner)
 {
 }
示例#17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DirectoryExistsValueDecorator"/> class.
 /// </summary>
 /// <param name="inner">The inner.</param>
 public DirectoryExistsValueDecorator(IConfigurationValue inner)
     : base(inner)
 {
 }
示例#18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ErrorReportingValueDecorator"/> class.
 /// </summary>
 /// <param name="inner">The inner.</param>
 public ErrorReportingValueDecorator(IConfigurationValue inner)
     : base(inner)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericConverterValueDecorator"/> class.
 /// </summary>
 /// <param name="inner">The inner.</param>
 /// <param name="conversionType">Type of the conversion.</param>
 /// <param name="defaultValue">The default value.</param>
 public GenericConverterValueDecorator(IConfigurationValue inner, Type conversionType, object defaultValue)
     : base(inner)
 {
     this._ConversionType = conversionType;
     this._DefaultValue = defaultValue;
 }
示例#20
0
 public void Initialize(IAppSettings appSettings, IEvaluateConfiguration configurationEvaluater)
 {
     ZoomLevel = new ConfigurationValue(appSettings, configurationEvaluater, "ZoomLevel", "ZoomLevel", defaultValue: "1");
 }
 public void Initialize(IAppSettings appSettings, IEvaluateConfiguration configurationEvaluater)
 {
     WebHook             = new ConfigurationValue(appSettings, configurationEvaluater, "SlackWebHook", "Web Hook", true);
     AnnouncementMessage = new ConfigurationValue(appSettings, configurationEvaluater, "SlackAnnouncementMessage", "Announcement message", defaultValue: "@here : Retrospective has started");
 }