Esempio n. 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);
        }
 public KeyVaultMappedJsonConfigurationProvider(
     KeyVaultMappedJsonConfigurationSource source,
     TimeSpan reloadTime) : base(source)
 {
     _timer = new Timer(Reload, null, reloadTime, reloadTime);
 }