Esempio n. 1
0
        private RelayConfig GetRelayConfig(ConDepRelayOptions relayOptions, ConDepOptions deployOptions)
        {
            if (relayOptions.HasAllOptionsSet())
            {
                return new RelayConfig
                       {
                           AccessKey    = relayOptions.AccessKey,
                           AccessSecret = relayOptions.AccessSecret,
                           Origin       = relayOptions.Origin,
                           RelayId      = relayOptions.RelayId
                       }
            }
            ;

            var path = !string.IsNullOrWhiteSpace(relayOptions.RelayConfigPath)
        ? relayOptions.RelayConfigPath
        : Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "relay.json");

            if (!File.Exists(path))
            {
                throw new FileNotFoundException("");
            }

            var serializer = new JsonSerializer <RelayConfig>(new JsonConfigCrypto(deployOptions.CryptoKey));

            return(serializer.DeSerialize(File.OpenRead(path)));
        }
Esempio n. 2
0
        private ArtifactManifest GetArtifactManifest(ConDepRelayOptions options, ConDepOptions deployOptions)
        {
            var path = !string.IsNullOrWhiteSpace(options.ArtifactManifestPath)
        ? options.ArtifactManifestPath
        : Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "artifacts.json");

            var parser =
                new ArtifactManifestConfigParser(
                    new JsonSerializer <ArtifactManifest>(new JsonConfigCrypto(deployOptions.CryptoKey)));
            var manifest = parser.GetTypedConfig(path);

            return(manifest);
        }