Exemple #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);
            }
        }
Exemple #2
0
 /// <summary>
 /// Defines a new application service type.
 /// </summary>
 /// <param name="name">Application service type name.</param>
 /// <param name="port">Application service port.</param>
 /// <param name="description">Application service description.</param>
 public void DefineServiceType(string name, int port, string description)
 {
     ServiceTypes[name] = new ServiceTypeInfo {
         Port = port, Description = description
     };
 }