Skip to content

Commit

Permalink
Merge pull request #956 from sitkoru/more-environments
Browse files Browse the repository at this point in the history
Expose more environments
  • Loading branch information
SonicGD authored Jun 28, 2024
2 parents 42989d0 + 0e3aecd commit a3646fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Sitko.Core.App/BuilderApplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public interface IApplicationEnvironment
string EnvironmentName { get; }
bool IsDevelopment();
bool IsProduction();
bool IsStaging();
bool IsEnvironment(string environmentName);
}

public class ServerApplicationEnvironment : IApplicationEnvironment
Expand All @@ -27,6 +29,8 @@ public class ServerApplicationEnvironment : IApplicationEnvironment
public bool IsDevelopment() => hostEnvironment.IsDevelopment();

public bool IsProduction() => hostEnvironment.IsProduction();
public bool IsStaging() => hostEnvironment.IsStaging();
public bool IsEnvironment(string environmentName) => hostEnvironment.IsEnvironment(environmentName);
}

public class BuilderApplicationContext : IApplicationContext
Expand Down Expand Up @@ -65,6 +69,10 @@ public BuilderApplicationContext(IConfiguration configuration, IApplicationEnvir
public bool IsDevelopment() => environment.IsDevelopment();

public bool IsProduction() => environment.IsProduction();
public bool IsStaging() => environment.IsStaging();

public bool IsEnvironment(string environmentName) => environment.IsEnvironment(environmentName);

public string[] Args { get; }

private ApplicationOptions GetApplicationOptions()
Expand Down
2 changes: 2 additions & 0 deletions src/Sitko.Core.App/IApplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public interface IApplicationContext
public string[] Args { get; }
bool IsDevelopment();
bool IsProduction();
bool IsStaging();
bool IsEnvironment(string environmentName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public WasmApplicationEnvironment(IWebAssemblyHostEnvironment builderHostEnviron
public bool IsDevelopment() => builderHostEnvironment.IsDevelopment();

public bool IsProduction() => builderHostEnvironment.IsProduction();
public bool IsStaging() => builderHostEnvironment.IsStaging();
public bool IsEnvironment(string environmentName) => builderHostEnvironment.IsEnvironment(environmentName);
}

public class SitkoCoreBlazorWasmApplicationBuilder : SitkoCoreBaseApplicationBuilder,
Expand Down

0 comments on commit a3646fe

Please sign in to comment.