mirror of
https://github.com/taigrr/shorturl
synced 2025-01-18 04:03:16 -08:00
Removed unused config
This commit is contained in:
parent
489d647a6f
commit
d4b2e6eac8
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
|
*.db
|
||||||
shorturl
|
shorturl
|
||||||
|
9
Makefile
9
Makefile
@ -3,11 +3,14 @@
|
|||||||
all: dev
|
all: dev
|
||||||
|
|
||||||
dev: build
|
dev: build
|
||||||
./shorturl -bind 127.0.0.1:8000
|
./shorturl
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
go get ./...
|
go get ./...
|
||||||
go build -o ./shorturl .
|
go build .
|
||||||
|
|
||||||
|
test:
|
||||||
|
go test ./...
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf bin shorturl
|
rm -rf shorturl
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestZeroConfig(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
|
|
||||||
cfg := Config{}
|
|
||||||
}
|
|
5
main.go
5
main.go
@ -8,8 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
cfg Config
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -31,5 +30,5 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
NewServer(bind, cfg).ListenAndServe()
|
NewServer(bind).ListenAndServe()
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
// Server ...
|
// Server ...
|
||||||
type Server struct {
|
type Server struct {
|
||||||
bind string
|
bind string
|
||||||
config Config
|
|
||||||
templates *templice.Template
|
templates *templice.Template
|
||||||
router *httprouter.Router
|
router *httprouter.Router
|
||||||
}
|
}
|
||||||
@ -82,10 +81,9 @@ func (s *Server) initRoutes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewServer ...
|
// NewServer ...
|
||||||
func NewServer(bind string, config Config) *Server {
|
func NewServer(bind string) *Server {
|
||||||
server := &Server{
|
server := &Server{
|
||||||
bind: bind,
|
bind: bind,
|
||||||
config: config,
|
|
||||||
router: httprouter.New(),
|
router: httprouter.New(),
|
||||||
templates: templice.New(rice.MustFindBox("templates")),
|
templates: templice.New(rice.MustFindBox("templates")),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user