Beispiel #1
0
        public VaultProviderSecretFile(VaultConfig cfg) : base(cfg)
        {
            var gsutilPath = Environment.GetEnvironmentVariable("IASC_GSUTIL_PATH");

            if (gsutilPath != null)
            {
                gsutilCmd = gsutilPath;
            }
        }
        public void VaultGetValueTest(string content, string key, string expValue)
        {
            Environment.SetEnvironmentVariable("IASC_GSUTIL_PATH", "gsutil");

            ICommandExecutor exec = CreateMockedExecutor(content);

            var vc = new VaultConfig();

            vc.SecretFileName = "gs://dummy/secrets.txt";

            var v = new VaultProviderSecretFile(vc);

            v.SetCmdExecutor(exec);
            v.SetGsutilCmd("gsutil");
            v.Load();

            string secretValue = v.GetValue(key);

            Assert.AreEqual(expValue, secretValue);
        }
Beispiel #3
0
        public static void Setup(string cfgFile, string extFile1)
        {
            //In the future we may load secret from many vault providers
            //But support only one for now

            var secretCfg = new VaultConfig()
            {
                SecretFileName = cfgFile
            };
            var secretFile = new VaultProviderSecretFile(secretCfg);

            providers.Add(secretFile);

            if (!string.IsNullOrEmpty(extFile1))
            {
                var secretExt1 = new VaultConfig()
                {
                    SecretFileName = extFile1
                };
                var secretFileExt1 = new VaultProviderSecretFile(secretExt1);
                providers.Add(secretFileExt1);
            }
        }
 protected VaultProviderBase(VaultConfig cfg)
 {
     config = cfg;
 }