Beispiel #1
0
        static Registry()
        {
            // testing service type
            if (Settings.DummiesEnabled)
            {
                Logger.LogDebug("loading dummy registry");
                var dummyCfg     = new Configuration();
                var dummySvcType = new ServiceTypeInfo {
                    Port = 0, Description = "A Dummy Service"
                };
                dummyCfg.ServiceTypes.Add("dummy-svc", dummySvcType);
                var dummyTarget = new TargetConfiguration();
                dummyTarget.Description = "A Dummy Target";
                dummyCfg.TargetConfigurations.Add("dummy-target", dummyTarget);
                AddRegistryConfiguration(dummyCfg);
            }

            // default service types
            var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "steeltoe.rc",
                                    "registry.yml");

            Logger.LogDebug($"loading registry from {path}");
            var deserializer = new DeserializerBuilder().Build();

            using (var reader = new StreamReader(path))
            {
                var defaultCfg = deserializer.Deserialize <Configuration>(reader);
                AddRegistryConfiguration(defaultCfg);
            }
        }
Beispiel #2
0
            /// <summary>
            /// Defines a new application service type property for a deployment target.
            /// </summary>
            /// <param name="target">Deployment target name.</param>
            /// <param name="serviceType">Application service type name.</param>
            /// <param name="propertyName">Application service type property name.</param>
            /// <param name="propertyValue">Application service type property value.</param>
            public void DefineTargetServiceTypeProperty(
                string target,
                string serviceType,
                string propertyName,
                string propertyValue)
            {
                if (!TargetConfigurations.ContainsKey(target))
                {
                    TargetConfigurations[target] = new TargetConfiguration();
                }

                var targetCfg = TargetConfigurations[target];

                if (!targetCfg.ServiceTypeProperties.ContainsKey(serviceType))
                {
                    targetCfg.ServiceTypeProperties[serviceType] = new Dictionary <string, string>();
                }

                targetCfg.ServiceTypeProperties[serviceType][propertyName] = propertyValue;
                TargetConfigurations[target] = targetCfg;
            }
Beispiel #3
0
 /// <summary>
 /// Defines a new deployment target.
 /// </summary>
 /// <param name="target">Deployment target name.</param>
 /// <param name="description">Deployment target description.</param>
 public void DefineTarget(string target, string description)
 {
     TargetConfigurations[target] = new TargetConfiguration {
         Description = description
     };
 }