Example #1
0
        public async Task InitializeAsync()
        {
            var options = new TOptions();
            var builder = ComposeResourceBuilder.New();

            options.Configure(builder);
            Settings = builder.Build();

            foreach (var name in BuildStartOrder())
            {
                var mgr = new ComposeResourceManager();
                mgr.ResourceSettings = Settings.Resources.First(x => x.Name == name);
                Managers.Add(name, mgr);

                var variables = new List <string>();
                foreach (ComposeResourceLink link in mgr.ResourceSettings.Links)
                {
                    foreach (EnvironmentVariableMapping map in link.EnvironmentVariables)
                    {
                        Dictionary <string, string> exports = Managers[link.Name].Exports;
                        variables.Add($"{map.Name}={GetVariableValue(map.Value, exports)}");
                    }
                }
                mgr.EnvironmentVariables = Settings.GlobalEnvionmentVariables.Concat(variables);
                await mgr.StartAsync();
            }
        }
Example #2
0
 public override void Configure(ComposeResourceBuilder builder)
 {
     builder.AddContainer <MongoDbContainer>("mongo");
     builder.AddContainer <WebApp>("webapp")
     .AddLink("mongo", new EnvironmentVariableMapping(
                  "Sample:Database:ConnectionString", "#CONNECTIONSTRING_INTERNAL#"
                  ));
 }
Example #3
0
        public override void Configure(ComposeResourceBuilder builder)
        {
            builder.AddGlobalEnvironmentVariable("FOO", "BAR");
            builder.AddContainer <MongoDefaultOptions>("mongo");
            builder.AddContainer <SampleAppOptions>("api")
            .AddLink("mongo", new EnvironmentVariableMapping(
                         "Sample:Database:ConnectionString",
                         "#CONNECTIONSTRING#"
                         ));

            builder.AddContainer <SampleAppOptions>("ui")
            .AddLink("api", new EnvironmentVariableMapping(
                         "Sample:Api:Url", "#HTTPURL#"
                         ));
        }