aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2017-01-26 20:17:55 -0800
committerAdam Mathes <adam@trenchant.org>2017-01-26 20:17:55 -0800
commit66b37908f062eef46594d52a905cd2bde55dd505 (patch)
tree5d5e7d86dc8aed3cec26323126f9527ad0888120
parent857ac6caf70eff11f0770972a7619e4e3229a39c (diff)
downloadneko-66b37908f062eef46594d52a905cd2bde55dd505.tar.gz
neko-66b37908f062eef46594d52a905cd2bde55dd505.tar.bz2
neko-66b37908f062eef46594d52a905cd2bde55dd505.zip
fix cmds
-rw-r--r--Makefile1
-rw-r--r--cmd/nekocrawl.go10
-rw-r--r--cmd/nekoweb.go10
-rw-r--r--cmd/util.go18
-rw-r--r--util/util.go18
5 files changed, 56 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index baef138..57c4c2a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,6 @@ $(BINARIES): $(SOURCES)
.PHONY: deps run
-
.PHONY: run
deps:
go get $(DEPS)
diff --git a/cmd/nekocrawl.go b/cmd/nekocrawl.go
new file mode 100644
index 0000000..e1dd6d0
--- /dev/null
+++ b/cmd/nekocrawl.go
@@ -0,0 +1,10 @@
+package main
+
+import (
+ "neko/crawler"
+ _ "neko/util"
+)
+
+func main() {
+ crawler.Crawl()
+}
diff --git a/cmd/nekoweb.go b/cmd/nekoweb.go
new file mode 100644
index 0000000..bebfebf
--- /dev/null
+++ b/cmd/nekoweb.go
@@ -0,0 +1,10 @@
+package main
+
+import (
+ "neko/web"
+ _ "neko/util"
+)
+
+func main() {
+ web.Serve()
+}
diff --git a/cmd/util.go b/cmd/util.go
new file mode 100644
index 0000000..ca12fdb
--- /dev/null
+++ b/cmd/util.go
@@ -0,0 +1,18 @@
+package util
+
+import (
+ "neko/config"
+ "neko/models"
+ "os"
+)
+
+var DEFAULT_CONFIG = "config.json"
+
+func init() {
+ var configFile = DEFAULT_CONFIG
+ if len(os.Args) > 1 {
+ configFile = os.Args[1]
+ }
+ config.Read(configFile)
+ models.InitDB(config.Config.DBServer)
+}
diff --git a/util/util.go b/util/util.go
new file mode 100644
index 0000000..ca12fdb
--- /dev/null
+++ b/util/util.go
@@ -0,0 +1,18 @@
+package util
+
+import (
+ "neko/config"
+ "neko/models"
+ "os"
+)
+
+var DEFAULT_CONFIG = "config.json"
+
+func init() {
+ var configFile = DEFAULT_CONFIG
+ if len(os.Args) > 1 {
+ configFile = os.Args[1]
+ }
+ config.Read(configFile)
+ models.InitDB(config.Config.DBServer)
+}