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(); } }
public override void Configure(ComposeResourceBuilder builder) { builder.AddContainer <MongoDbContainer>("mongo"); builder.AddContainer <WebApp>("webapp") .AddLink("mongo", new EnvironmentVariableMapping( "Sample:Database:ConnectionString", "#CONNECTIONSTRING_INTERNAL#" )); }
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#" )); }