Exemple #1
0
        public override AzureFileAccount Provide(AzureFileAccountProviderContext context)
        {
            if (context.secrets.TryGetValue(nameAccountName, out var name))
            {
                if (!context.secrets.TryGetValue(nameAccountKey, out var key))
                {
                    throw new Exception("No key provided");
                }
                var afa = new AzureFileAccount
                {
                    Id = new AzureFileAccountId
                    {
                        Name = name,
                    },
                    Key = key,
                };

                if (context.secrets.TryGetValue(nameCloudEnv, out var env) && !string.IsNullOrEmpty(env))
                {
                    afa.Id.EnvironmentName = env;
                }

                logger.LogDebug("Provide account {0} from secret", name);

                return(afa);
            }

            return(Next.Provide(context));
        }
Exemple #2
0
        public AzureFileAccount Provide(AzureFileAccountProviderContext context)
        {
            if (defaultAzureFileAccount != null)
            {
                logger.LogDebug("Provide account {0} from environment", defaultAzureFileAccount.Id.Name);
                return(defaultAzureFileAccount);
            }

            return(null);
        }
        public override AzureFileAccount Provide(AzureFileAccountProviderContext context)
        {
            var afa = Next.Provide(context);

            if (afa == null)
            {
                throw new Exception("Cannot provide account");
            }
            return(afa);
        }