mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-22 07:18:11 -07:00
move db init/open functions into a single file
This commit is contained in:
+1
-7
@@ -7,7 +7,6 @@ import (
|
||||
"database/sql"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
@@ -36,17 +35,12 @@ type Server struct {
|
||||
}
|
||||
|
||||
func NewServer(config *Config) *Server {
|
||||
db, err := sql.Open("sqlite3", config.Database())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
server := &Server{
|
||||
channels: make(ChannelNameMap),
|
||||
clients: make(ClientNameMap),
|
||||
commands: make(chan Command, 16),
|
||||
ctime: time.Now(),
|
||||
db: db,
|
||||
db: OpenDB(config.Database()),
|
||||
idle: make(chan *Client, 16),
|
||||
motdFile: config.MOTD,
|
||||
name: config.Name,
|
||||
|
||||
Reference in New Issue
Block a user