In a previous post published on the 6th of July, 2014, I talked about my IRC bot Kittens that I started rewriting in Go. If you haven't read that yet, you should catch up before reading on here! This blog post is about the recent updates to Kittens, and the release of version
Previously there was no web security at all, and there were no users. Now there is a hierarchy when it comes to a user and their bots. When Kittens is started for the first time (read: connected to an empty database), it will create a user with the username
admin and the password
admin. Both the username and password of all users can be changed at any time through the
/settings page on the web interface. Currently there is only one user (although you could go into the database and copy the row and switch the username of the new row to create a new user), but multiple user support from the web interface is coming in Version 0.2.
Passwords are hashed with the bcrypt library, with
bcrypt.DefaultCost as the cost, and are stored as strings in the database.
Each user can create and run as many servers (bots) as they want. Although I'm calling each bot a
Server, a user can create multiple bots that connect to the same IRC server if they wished, but that's (probably) not normally the case. When a user adds a new server, they claim ownership of that server and can edit/view it from the web interface.
Kittens has--since the beginning--used a flat JSON file to store everything. With the direction in which I want to take Kittens, this just is not going to scale well. Sure, you could continue to just use one single JSON file forever, but at some point you really shouldn't.
Continuing with the removing of
config.json, a lot of other options have been created as flags that used to be in the configuration file.
By including the debug flag, Kittens will do the following:
By default, Kittens sets debug to
By including the webserver port flag you can change the port that Kittens webserver listens on by default. By default Kittens webserver listens on port
By including the webserver interface flag you can change the interface that Kittens webserver binds to by default. By default the Kittens webserver binds to the interface
By including the database driver flag you can change the type of database that we are connecting to. By default Kittens uses
sqlite3 as the default driver because Kittens uses a SQLite3 database as default. If you change the database driver, you need to change the database connection details or it will not work.
Kittens supports SQLite, MySQL, and PostgreSQL. To see how to use the database driver flag with the database flag, read the information on the database flag.
By including the database flag you can change the connection details that we use. By default Kittens uses
kittens.db as the database to connect to. If you change the database, you need to change the database driver or it will not work.
Kittens supports SQLite, MySQL, and PostgreSQL. The full list of options for database connection details can be found on each's website respectively. Here is an example for each:
--driver sqlite3 --database /etc/kittens.db
--driver postgres --database "user=username dbname=kittens sslmode=disable"
--driver mysql --database "username:password@tcp(host:port)/database"
?parseTime=true is not included in the database string when connecting to a MySQL database, Kittens will automatically add it before trying to connect. It is needed in order for Kittens to work properly.
Kittens is still lacking some features before it's actually worth using (unless you just want a bot that idles). For a full list of issues and upcoming features, you can checkout the full list on GitHub.
For anyone that sees this and wants to contribute, I welcome them! Kittens is open sourced on GitHub, and I would gladly accept pull requests that fix problems or implement something that has yet to be implemented.
For more information checkout the README file.