@@ -4,58 +4,61 @@ namespace SharedKernel.Extensions;
44
55public static class HostEnvironmentExtensions
66{
7- public static bool IsQa ( this IHostEnvironment hostEnvironment )
7+ extension ( IHostEnvironment hostEnvironment )
88 {
9- ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
10-
11- return hostEnvironment . IsEnvironment ( "QA" ) ;
12- }
13-
14- public static bool IsLocal ( this IHostEnvironment hostEnvironment )
15- {
16- ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
17-
18- return hostEnvironment . IsEnvironment ( "Local" ) ;
19- }
20-
21- public static bool IsLocalOrDevelopment ( this IHostEnvironment hostEnvironment )
22- {
23- ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
24-
25- return hostEnvironment . IsLocal ( ) || hostEnvironment . IsDevelopment ( ) ;
26- }
27-
28- public static bool IsLocalOrDevelopmentOrQa ( this IHostEnvironment hostEnvironment )
29- {
30- ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
31-
32- return hostEnvironment . IsLocal ( ) || hostEnvironment . IsDevelopment ( ) || hostEnvironment . IsQa ( ) ;
33- }
9+ public bool IsQa ( )
10+ {
11+ ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
3412
35- public static string GetShortEnvironmentName ( this IHostEnvironment environment )
36- {
37- ArgumentNullException . ThrowIfNull ( environment ) ;
13+ return hostEnvironment . IsEnvironment ( "QA" ) ;
14+ }
3815
39- if ( environment . IsLocal ( ) )
16+ public bool IsLocal ( )
4017 {
41- return "local" ;
18+ ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
19+
20+ return hostEnvironment . IsEnvironment ( "Local" ) ;
4221 }
4322
44- if ( environment . IsDevelopment ( ) )
23+ public bool IsLocalOrDevelopment ( )
4524 {
46- return "dev" ;
25+ ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
26+
27+ return hostEnvironment . IsLocal ( ) || hostEnvironment . IsDevelopment ( ) ;
4728 }
4829
49- if ( environment . IsQa ( ) )
30+ public bool IsLocalOrDevelopmentOrQa ( )
5031 {
51- return "qa" ;
32+ ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
33+
34+ return hostEnvironment . IsLocal ( ) || hostEnvironment . IsDevelopment ( ) || hostEnvironment . IsQa ( ) ;
5235 }
5336
54- if ( environment . IsStaging ( ) )
37+ public string GetShortEnvironmentName ( )
5538 {
56- return "staging" ;
57- }
39+ ArgumentNullException . ThrowIfNull ( hostEnvironment ) ;
40+
41+ if ( hostEnvironment . IsLocal ( ) )
42+ {
43+ return "local" ;
44+ }
45+
46+ if ( hostEnvironment . IsDevelopment ( ) )
47+ {
48+ return "dev" ;
49+ }
5850
59- return "" ;
51+ if ( hostEnvironment . IsQa ( ) )
52+ {
53+ return "qa" ;
54+ }
55+
56+ if ( hostEnvironment . IsStaging ( ) )
57+ {
58+ return "staging" ;
59+ }
60+
61+ return "" ;
62+ }
6063 }
6164}
0 commit comments