public static IConfigurationBuilder AddKeyVaultMappedJsonFile(
            this IConfigurationBuilder builder,
            IFileProvider provider,
            string path,
            bool optional,
            bool reloadOnChange,
            string vaultUri,
            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)
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            return(builder);
        }
示例#2
0
 public KeyVaultMappedJsonConfigurationProvider(KeyVaultMappedJsonConfigurationSource source) : base(source)
 {
 }