示例#1
0
        public static IConfigurationBuilder AddKeyVaultMappedJsonFile(
            this IConfigurationBuilder builder,
            IFileProvider provider,
            string path,
            bool optional,
            bool reloadOnChange,
            string vaultUri,
            TimeSpan reloadTime,
            Func <KeyVaultClient> clientFactory)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("Invalid File Path", nameof(path));
            }

            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path     = Path.GetFileName(path);
            }

            var source = new KeyVaultMappedJsonConfigurationSource(clientFactory, vaultUri, reloadTime)
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            return(builder);
        }
示例#2
0
 public KeyVaultMappedJsonConfigurationProvider(KeyVaultMappedJsonConfigurationSource source) : base(source)
 {
 }
示例#3
0
 public KeyVaultMappedJsonConfigurationProvider(
     KeyVaultMappedJsonConfigurationSource source,
     TimeSpan reloadTime) : base(source)
 {
     _timer = new Timer(Reload, null, reloadTime, reloadTime);
 }