Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Missing documentation for bot configuration #261

Closed
noraj opened this issue Nov 3, 2018 · 5 comments
Closed

Missing documentation for bot configuration #261

noraj opened this issue Nov 3, 2018 · 5 comments

Comments

@noraj
Copy link
Contributor

noraj commented Nov 3, 2018

Ok there is this provided as KnownOptions of the bot configuration, but it is not clear what each key tag is expecting as value.

    [:server, :port, :ssl, :password, :nick, :nicks,
    :realname, :user, :messages_per_second, :server_queue_size,
    :strictness, :message_split_start, :message_split_end,
    :max_messages, :plugins, :channels, :encoding, :reconnect, :max_reconnect_delay,
    :local_host, :timeouts, :ping_interval, :delay_joins, :dcc, :shared, :sasl]

For example it is obvious that server is expecting a string with an ip address or a domain but is port expecting a string or an integer (answer is integer), and ssl? I thought ssl was expecting a boolean true or false but I seems that's not that.

Each key expected value should be documented.

one should not have to do reverse engineering, calling .default_config to understand the expected values.

Also this method is not working for the bot class and return an empty hash for the configuration parent class:

irb(main):001:0> require 'cinch'
=> true
irb(main):002:0> Cinch::Bot.default_config
Traceback (most recent call last):
        2: from /home/noraj/.rbenv/versions/2.5.1/bin/irb:11:in `<main>'
        1: from (irb):2
NoMethodError (undefined method `default_config' for Cinch::Bot:Class)
irb(main):003:0> Cinch::Configuration.default_config
=> {}

https://www.rubydoc.info/gems/cinch/Cinch/Configuration/Bot

@noraj
Copy link
Contributor Author

noraj commented Nov 3, 2018

I had to got in the code to see the default config to understand what is expected.

# (see Configuration.default_config)
def self.default_config
{
:server => "localhost",
:port => 6667,
:ssl => Configuration::SSL.new,
:password => nil,
:nick => "cinch",
:nicks => nil,
:realname => "cinch",
:user => "cinch",
:modes => [],
:messages_per_second => nil,
:server_queue_size => nil,
:strictness => :forgiving,
:message_split_start => '... ',
:message_split_end => ' ...',
:max_messages => nil,
:plugins => Configuration::Plugins.new,
:channels => [],
:encoding => :irc,
:reconnect => true,
:max_reconnect_delay => 300,
:local_host => nil,
:timeouts => Configuration::Timeouts.new,
:ping_interval => 120,
:delay_joins => 0,
:dcc => Configuration::DCC.new,
:sasl => Configuration::SASL.new,
:shared => {},
}
end

      # (see Configuration.default_config)
      def self.default_config
        {
          :server => "localhost",
          :port   => 6667,
          :ssl    => Configuration::SSL.new,
          :password => nil,
          :nick   => "cinch",
          :nicks  => nil,
          :realname => "cinch",
          :user => "cinch",
          :modes => [],
          :messages_per_second => nil,
          :server_queue_size => nil,
          :strictness => :forgiving,
          :message_split_start => '... ',
          :message_split_end   => ' ...',
          :max_messages => nil,
          :plugins => Configuration::Plugins.new,
          :channels => [],
          :encoding => :irc,
          :reconnect => true,
          :max_reconnect_delay => 300,
          :local_host => nil,
          :timeouts => Configuration::Timeouts.new,
          :ping_interval => 120,
          :delay_joins => 0,
          :dcc => Configuration::DCC.new,
          :sasl => Configuration::SASL.new,
          :shared => {},
        }
      end

So in fact ssl is expecting an SSL object.

@noraj
Copy link
Contributor Author

noraj commented Nov 3, 2018

Even knowing that and trying various configuration

ssl = Cinch::Configuration::SSL.new do |ssl|
    configure do |s|
        s.use       = true
        s.verify    = false
    end
end

I did not succeed to configure the bot to use SSL and connect to a 6697 port.

@noraj
Copy link
Contributor Author

noraj commented Nov 3, 2018

The good syntax was

bot = Cinch::Bot.new do |boti|
    configure do |c|
        c.server    = "172.17.0.1"
        c.port      = 6697
        c.ssl.use   = true
        c.nick      = "plop"
    end
...

By the way I see you are using OpenSSL to manage SSL connection but there is no `dependencies` section in the README or in the documentation.

![image](https://user-images.githubusercontent.com/16578570/47953558-98ab3d80-df7f-11e8-9594-26a86908885c.png)

@dominikh
Copy link
Member

dominikh commented Nov 3, 2018

@dominikh dominikh closed this as completed Nov 3, 2018
@noraj
Copy link
Contributor Author

noraj commented Nov 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants