/// <summary>
        /// Initializes a new instance of the <see cref="KuduProvider"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        internal KuduProvider(ICakeContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var environmenVariables = context.EnvironmentVariables();

            Deployment  = new Deployment(environmenVariables);
            WebSite     = new WebSite(environmenVariables);
            SCM         = new SCM(environmenVariables);
            Tools       = new Tools(environmenVariables);
            AppSettings = environmenVariables
                          .Where(key => key.Key.StartsWith("APPSETTING_"))
                          .ToDictionary(
                key => string.Concat(key.Key.Skip(11)),
                value => value.Value
                );
            ConnectionStrings = environmenVariables
                                .Where(key => key.Key.StartsWith("SQLAZURECONNSTR_"))
                                .ToDictionary(
                key => string.Concat(key.Key.Skip(16)),
                value => value.Value
                );
            IsRunningOnKudu = !string.IsNullOrWhiteSpace(WebSite.Name);


            _kuduSyncRunner = new KuduSyncRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KuduProvider"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        internal KuduProvider(ICakeContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var environmenVariables = context.EnvironmentVariables();
            Deployment = new Deployment(environmenVariables);
            WebSite = new WebSite(environmenVariables);
            SCM = new SCM(environmenVariables);
            Tools = new Tools(environmenVariables);
            AppSettings = environmenVariables
                .Where(key => key.Key.StartsWith("APPSETTING_"))
                .ToDictionary(
                    key => string.Concat(key.Key.Skip(11)),
                    value => value.Value
                );
            ConnectionStrings = environmenVariables
                .Where(key => key.Key.StartsWith("SQLAZURECONNSTR_"))
                .ToDictionary(
                    key => string.Concat(key.Key.Skip(16)),
                    value => value.Value
                );
            IsRunningOnKudu = !string.IsNullOrWhiteSpace(WebSite.Name);


            _kuduSyncRunner = new KuduSyncRunner(context.FileSystem, context.Environment, context.Globber, context.ProcessRunner);
        }