Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. AwsContext
  2. {
  3.    internal string Foo { get; private set; }
  4.    internal string Bar { get; private set; }
  5.    internal string Etc { get; private set; }
  6.  
  7.    internal static AwsContext LoadContext() {
  8.      AwsContext context;
  9.  
  10.      if (bool.TryParse(Environment.GetEnvironmentVariable("use_env_context"), out isEnvContext) && isEnvContext)
  11.      {  
  12.         context = AwsContext();
  13.         context.LoadEnvContext();  
  14.      }
  15.      else
  16.      {
  17.         context = AwsContext.LoadJsonContext();
  18.      }
  19.  
  20.      return context;
  21.    }
  22.  
  23.    internal AwsContext LoadEnvContext()
  24.    {
  25.       Foo = GoGet("Foo");
  26.       Bar = GoGet("Bar");
  27.       Etc = GoGet("Etc");
  28.    
  29.       LogValues();
  30.    }
  31.  
  32.    internal static AwsContext LoadJsonContext()
  33.    {
  34.       var context = Json.Deserialize<AwsContext>(File.ReadAllText(Paths.AwsContextFile));
  35.       context.LogValues();
  36.       return context;
  37.    }
  38.  
  39. }
  40.  
  41.  
  42. MainServiceCore
  43. {
  44.    context.AwsContext = AwsContext.LoadContext();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement