Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Basepath is removed from template but is needed by UserSecrets #47

Closed
Anderman opened this issue Oct 28, 2015 · 1 comment
Closed

Basepath is removed from template but is needed by UserSecrets #47

Anderman opened this issue Oct 28, 2015 · 1 comment

Comments

@Anderman
Copy link

see aspnet/Configuration#295, aspnet/Templates#269

public static class ConfigurationExtensions
    {
        /// <summary>
        /// Adds the user secrets configuration source.
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (string.IsNullOrEmpty(configuration.GetBasePath()))
            {
                throw new InvalidOperationException(Resources.FormatError_MissingBasePath(
                    configuration.GetBasePath(),
                    typeof(IConfigurationBuilder).Name,
                    "BasePath"));
            }

            var secretPath = PathHelper.GetSecretsPath(configuration.GetBasePath());
            return configuration.AddJsonFile(secretPath, optional: true);
        }
@Anderman
Copy link
Author

Sorry, I just tested this in the latest dev branches and it works fine

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant