Akka.Configuration.Config.HasPath C# (CSharp) Method

HasPath() public method

Determine if a HOCON configuration element exists at the specified location
public HasPath ( string path ) : bool
path string The location to check for a configuration value.
return bool
        public virtual bool HasPath(string path)
        {
            HoconValue value = GetNode(path);
            return value != null;
        }

Usage Example

        public SessionSettings(Config config)
        {
            if (config == null) throw new ArgumentNullException("config");

            Builder = Cluster.Builder();
            
            // Get IP and port configuration
            int port = config.GetInt("port", 9042);
            IPEndPoint[] contactPoints = ParseContactPoints(config.GetStringList("contact-points"), port);
            Builder.AddContactPoints(contactPoints);

            // Support user/pass authentication
            if (config.HasPath("credentials"))
                Builder.WithCredentials(config.GetString("credentials.username"), config.GetString("credentials.password"));

            // Support SSL
            if (config.GetBoolean("ssl"))
                Builder.WithSSL();

            // Support compression
            string compressionTypeConfig = config.GetString("compression");
            if (compressionTypeConfig != null)
            {
                var compressionType = (CompressionType) Enum.Parse(typeof (CompressionType), compressionTypeConfig, true);
                Builder.WithCompression(compressionType);
            }
        }
All Usage Examples Of Akka.Configuration.Config::HasPath