Skip to content

Commit

Permalink
Merge pull request #1347 from jehiah/nsqadmin_query_graphite_ephemera…
Browse files Browse the repository at this point in the history
…l_topics_1347

nsqadmin: use go:embed; match graphite key valid charset
  • Loading branch information
mreiferson authored Aug 16, 2021
2 parents d4fdb4b + b20f230 commit 120356d
Show file tree
Hide file tree
Showing 23 changed files with 7,620 additions and 89 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.godeps
vendor
build/
.cover/
apps/nsqlookupd/nsqlookupd
apps/nsqd/nsqd
Expand All @@ -15,7 +14,6 @@ apps/nsq_to_http/nsq_to_http
apps/nsq_tail/nsq_tail
apps/nsq_stat/nsq_stat
apps/to_nsq/to_nsq
nsqadmin/static/build
dist
_site
_posts
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nsqio/nsq

go 1.13
go 1.16

require (
github.com/BurntSushi/toml v0.3.1
Expand Down
20 changes: 10 additions & 10 deletions nsqadmin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ administrative tasks.
Read the [docs](https://nsq.io/components/nsqadmin.html)


## Local Development
## Local Development (Go 1.16+)

### Dependencies

1. Install [`go-bindata`](https://github.com/shuLhan/go-bindata)
2. Install NodeJS 14.x (includes npm)
1. Install NodeJS 16.x (includes `npm`)

### Workflow
### Live Reload Workflow

1. `$ npm install`
2. `$ ./gulp --series clean watch` or `$ ./gulp --series clean build`
3. `$ go-bindata --debug --pkg=nsqadmin --prefix=static/build/ static/build/...`
4. `$ go build ../apps/nsqadmin && ./nsqadmin`
5. make changes (repeat step 4 only if you make changes to any Go code)
6. `$ go-bindata --pkg=nsqadmin --prefix=static/build/ static/build/...`
7. commit other changes and `bindata.go`
2. `$ ./gulp --series clean watch`
3. `$ go build --tags debug` (from `apps/nsqadmin` directory)
4. make changes to static assets (repeat step 3 only if you make changes to any Go code)

### Build

1. `$ ./gulp --series clean build`
32 changes: 16 additions & 16 deletions nsqadmin/bindata.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nsqadmin/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (s *httpServer) indexHandler(w http.ResponseWriter, req *http.Request, ps h
func (s *httpServer) staticAssetHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params) (interface{}, error) {
assetName := ps.ByName("asset")

asset, err := Asset(assetName)
asset, err := staticAsset(assetName)
if err != nil {
return nil, http_api.Err{404, "NOT_FOUND"}
}
Expand Down
130 changes: 74 additions & 56 deletions nsqadmin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions nsqadmin/static.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// +build go1.16
// +build !debug

package nsqadmin

import (
"embed"
)

//go:embed static/build
var static embed.FS

func staticAsset(name string) ([]byte, error) {
return static.ReadFile("static/build/" + name)
}
Loading

0 comments on commit 120356d

Please sign in to comment.