don't look for base32 in ircd.yml
This commit is contained in:
19
irc/irc.go
19
irc/irc.go
@ -1,22 +1,16 @@
|
||||
package trayirc
|
||||
|
||||
import (
|
||||
// "fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
// "strings"
|
||||
// "runtime"
|
||||
"path/filepath"
|
||||
|
||||
//"github.com/khlieng/dispatch/assets"
|
||||
"github.com/khlieng/dispatch/config"
|
||||
"github.com/khlieng/dispatch/server"
|
||||
"github.com/khlieng/dispatch/storage"
|
||||
"github.com/khlieng/dispatch/storage/bleve"
|
||||
"github.com/khlieng/dispatch/storage/boltdb"
|
||||
// "github.com/khlieng/dispatch/version"
|
||||
// "github.com/spf13/cobra"
|
||||
// "github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var configfile = `# IP address to listen on, leave empty to listen on anything
|
||||
@ -137,9 +131,18 @@ func initConfig(configPath string, overwrite bool) error {
|
||||
}
|
||||
|
||||
func IRC(confdir string) {
|
||||
|
||||
if _, err := os.Stat(filepath.Join(confdir, "irc.running")); !os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
err := ioutil.WriteFile(filepath.Join(confdir, "irc.running"), []byte(motd), 0644)
|
||||
if err != nil {
|
||||
log.Fatal("Error outputting runfile, %s", err)
|
||||
}
|
||||
|
||||
storage.Initialize(confdir, confdir, confdir)
|
||||
|
||||
err := initConfig(storage.Path.Config(), false)
|
||||
err = initConfig(storage.Path.Config(), false)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
12
irc/serv.go
12
irc/serv.go
@ -47,7 +47,7 @@ func GenerateEncodedPassword(passwd []byte) (encoded string, err error) {
|
||||
}
|
||||
|
||||
func OutputAutoLink(dir, configfile string) string {
|
||||
f, err := ioutil.ReadFile(filepath.Join(dir, configfile))
|
||||
f, err := ioutil.ReadFile(filepath.Join(dir, configfile+".i2p.public.txt"))
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
@ -94,11 +94,11 @@ func OutputServerConfigFile(dir, configfile string) (string, error) {
|
||||
password: ""
|
||||
i2plisten:
|
||||
invisibleirc:
|
||||
i2pkeys: "` + filepath.Join(dir, "iirc.i2pkeys") + `"
|
||||
i2pkeys: "` + filepath.Join(dir, "iirc") + `"
|
||||
samaddr: 127.0.0.1:7656
|
||||
#torlisten:
|
||||
#hiddenirc:
|
||||
#torkeys: ` + filepath.Join(dir, "tirc.torkeys") + `
|
||||
#torkeys: ` + filepath.Join(dir, "tirc") + `
|
||||
#controlport: 0
|
||||
log: ""
|
||||
motd: ` + filepath.Join(dir, "ircd.motd") + `
|
||||
@ -166,6 +166,10 @@ func IRCServerMain(version, debug bool, dir, configfile string) {
|
||||
func Close(dir, configfile string) {
|
||||
err := os.Remove(filepath.Join(dir, "ircd.running"))
|
||||
if err != nil {
|
||||
log.Fatal("Error removing runfile, %s", err)
|
||||
log.Printf("Error removing runfile, %s", err)
|
||||
}
|
||||
err = os.Remove(filepath.Join(dir, "irc.running"))
|
||||
if err != nil {
|
||||
log.Printf("Error removing runfile, %s", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user