예제 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            //Compile Function on startup time:
            var function = FunctionFactory.BuildFunction(Configuration);


            ICompiler compiler;

            string directory = Environment.GetEnvironmentVariable("DOTNETCORE_HOME");

            if (Directory.Exists(directory))
            {
                compiler = new DefaultCompiler(new DefaultParser(), new WithDependencyReferencesManager());
            }
            else
            {
                compiler = new DefaultCompiler(new DefaultParser(), new WithoutDependencyReferencesManager());
            }

            if (!function.IsCompiled())
            {
                compiler.Compile(function);
            }

            services.AddSingleton <IFunction>(function);

            int timeout = int.Parse(VariablesUtils.GetEnvironmentVariable("FUNC_TIMEOUT", "180"));

            services.AddSingleton <IInvoker>(new TimeoutInvoker(timeout * 1000)); // seconds
            services.AddSingleton <IParameterHandler>(new DefaultParameterHandler());
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            services.AddSingleton <IFunction>(FunctionFactory.BuildFunction(Configuration));
            services.AddSingleton <ICompiler>(new DefaultCompiler(new DefaultParser(), new DefaultReferencesManager()));
            services.AddSingleton <IInvoker>(new DefaultInvoker());
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            //Compile Function.
            var function = FunctionFactory.BuildFunction(Configuration);
            var compiler = new DefaultCompiler(new DefaultParser(), new DefaultReferencesManager());

            if (!function.IsCompiled())
            {
                compiler.Compile(function);
            }

            services.AddSingleton <IFunction>(function);
            services.AddSingleton <IInvoker>(new DefaultInvoker());
        }
예제 #4
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            var function = FunctionFactory.BuildFunction(Configuration);

            if (!function.IsCompiled())
            {
                throw new FileNotFoundException(nameof(function.FunctionSettings.ModuleName));
            }

            services.AddSingleton <IFunction>(function);

            int timeout = int.Parse(VariablesUtils.GetEnvironmentVariable("FUNC_TIMEOUT", "180"));

            services.AddSingleton <IInvoker>(new CompiledFunctionInvoker(timeout * 1000)); // seconds
            services.AddSingleton <IParameterHandler>(new DefaultParameterHandler());
        }