Inheritance: IEnvironment
Esempio n. 1
0
        /// <summary>
        /// Sets the environment variables for Net Core CLI.
        /// </summary>
        /// <remarks>
        /// This method previously included environment variables to optimize net core runtime to run in a container.
        /// But they have been moved to the Kudu Dockerfile
        /// </remarks>>
        /// <param name="environment">
        /// IEnvironment object that maintains references to al the paths used by Kudu during runtime.
        /// </param>
        internal static void EnsureDotNetCoreEnvironmentVariable(IEnvironment environment)
        {
            if (Environment.IsAzureEnvironment())
            {
                // On Azure, restore nuget packages to d:\home\.nuget so they're persistent. It also helps
                // work around https://github.com/projectkudu/kudu/issues/2056.
                // Note that this only applies to project.json scenarios (not packages.config)
                SetEnvironmentVariableIfNotYetSet("NUGET_PACKAGES", Path.Combine(environment.RootPath, ".nuget"));

                // Set the telemetry environment variable
                SetEnvironmentVariableIfNotYetSet("DOTNET_CLI_TELEMETRY_PROFILE", "AzureKudu");
            }
            else
            {
                // Set it slightly differently if outside of Azure to differentiate
                SetEnvironmentVariableIfNotYetSet("DOTNET_CLI_TELEMETRY_PROFILE", "Kudu");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            string repositoryPath = Path.Combine(Root, RepositoryPath);
            string deployPath = Path.Combine(Root, DeploymentTargetPath);
            string buildPath = Path.Combine(Root, BuildOutputPath);

            var environment = new Environment(repositoryPath, deployPath, buildPath);

            var repositoryManager = new RepositoryManager(environment.RepositoryPath);
            var deployerFactory = new DeployerFactory(environment);
            var deploymentManager = new DeploymentManager(repositoryManager, deployerFactory);
            var fileSystemFactory = new FileSystemFactory(environment);

            kernel.Bind<IRepositoryManager>().ToConstant(repositoryManager);
            kernel.Bind<IDeployerFactory>().ToConstant(deployerFactory);
            kernel.Bind<IDeploymentManager>().ToConstant(deploymentManager);
            kernel.Bind<IFileSystemFactory>().ToConstant(fileSystemFactory);
            kernel.Bind<ServerRepository>().ToMethod(_ => new ServerRepository(repositoryPath));
        }