Skip to content

Commit

Permalink
Adapt to iota 2.0 (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Apr 19, 2024
1 parent d3e71dd commit 815a1a5
Show file tree
Hide file tree
Showing 106 changed files with 1,771 additions and 1,517 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.DS_Store
inx-dashboard
identity.key
.vscode/
shutdown.log
8 changes: 3 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ linters-settings:
simplify: true
goimports:
local-prefixes: github.com/iotaledger
golint:
min-confidence: 0.9
gocyclo:
min-complexity: 15
govet:
check-shadowing: false
disable:
- shadow
misspell:
locale: US
staticcheck:
Expand All @@ -24,7 +23,6 @@ linters:
disable-all: true
# Enable specific linter
enable:
- deadcode
- errcheck
- gosimple
- govet
Expand All @@ -38,7 +36,7 @@ linters:
- bidichk
- bodyclose
- containedctx
- contextcheck
#- contextcheck # this linter is buggy and renders all nolint rules useless
- decorder
#- depguard
- dogsled
Expand Down
12 changes: 6 additions & 6 deletions components/dashboard/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ func provide(c *dig.Container) error {

type dashboardDeps struct {
dig.In
NodeBridge *nodebridge.NodeBridge
NodeBridge nodebridge.NodeBridge
}

if err := c.Provide(func(deps dashboardDeps) *dashboard.Dashboard {

username := ParamsDashboard.Auth.Username
if len(username) == 0 {
Component.LogErrorfAndExit("%s cannot be empty", Component.App().Config().GetParameterPath(&(ParamsDashboard.Auth.Username)))
Component.LogFatalf("%s cannot be empty", Component.App().Config().GetParameterPath(&(ParamsDashboard.Auth.Username)))
}
if len(username) > maxDashboardAuthUsernameSize {
Component.LogErrorfAndExit("%s has a max length of %d", Component.App().Config().GetParameterPath(&(ParamsDashboard.Auth.Username)), maxDashboardAuthUsernameSize)
Component.LogFatalf("%s has a max length of %d", Component.App().Config().GetParameterPath(&(ParamsDashboard.Auth.Username)), maxDashboardAuthUsernameSize)
}

acceptOptions := &websocket.AcceptOptions{
Expand All @@ -64,12 +64,12 @@ func provide(c *dig.Container) error {
CompressionMode: websocket.CompressionDisabled,
}

hub := websockethub.NewHub(Component.Logger(), acceptOptions, broadcastQueueSize, clientSendChannelSize, maxWebsocketMessageSize)
hub := websockethub.NewHub(Component.Logger, acceptOptions, broadcastQueueSize, clientSendChannelSize, maxWebsocketMessageSize)

Component.LogInfo("Setting up dashboard ...")

return dashboard.New(
Component.Logger(),
Component.Logger.NewChildLogger("Dashboard"),
Component.Daemon(),
deps.NodeBridge,
hub,
Expand Down Expand Up @@ -97,7 +97,7 @@ func provide(c *dig.Container) error {
}

func configure() error {
deps.Dashboard.Init()
deps.Dashboard.Init(Component.Daemon().ContextStopped())

return nil
}
Expand Down
6 changes: 3 additions & 3 deletions components/prometheus/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/dig"

"github.com/iotaledger/hive.go/app"
"github.com/iotaledger/hive.go/ierrors"
"github.com/iotaledger/inx-dashboard/pkg/daemon"
)

Expand Down Expand Up @@ -88,7 +88,7 @@ func run() error {

go func() {
Component.LogInfof("You can now access the Prometheus exporter using: http://%s/metrics", ParamsPrometheus.BindAddress)
if err := deps.PrometheusEcho.Start(ParamsPrometheus.BindAddress); err != nil && !errors.Is(err, http.ErrServerClosed) {
if err := deps.PrometheusEcho.Start(ParamsPrometheus.BindAddress); err != nil && !ierrors.Is(err, http.ErrServerClosed) {
Component.LogWarnf("Stopped Prometheus exporter due to an error (%s)", err)
}
}()
Expand All @@ -102,7 +102,7 @@ func run() error {
//nolint:contextcheck // false positive
err := deps.PrometheusEcho.Shutdown(shutdownCtx)
if err != nil {
Component.LogWarn(err)
Component.LogWarn(err.Error())
}

Component.LogInfo("Stopping Prometheus exporter ... done")
Expand Down
12 changes: 3 additions & 9 deletions config_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@
}
},
"logger": {
"name": "",
"level": "info",
"disableCaller": true,
"disableStacktrace": false,
"stacktraceLevel": "panic",
"encoding": "console",
"encodingConfig": {
"timeEncoder": "rfc3339"
},
"timeFormat": "rfc3339",
"outputPaths": [
"stdout"
],
"disableEvents": true
]
},
"inx": {
"address": "localhost:9029",
Expand Down
37 changes: 10 additions & 27 deletions configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# This file is auto-generated by the gendoc tool based on the source code of the app.
description: This section describes the configuration parameters and their types for INX-Dashboard.
keywords:
- IOTA Node
- Hornet Node
- IOTA Node
- Dashboard
- Configuration
- JSON
Expand Down Expand Up @@ -71,40 +70,24 @@ Example:

## <a id="logger"></a> 2. Logger

| Name | Description | Type | Default value |
| ---------------------------------------- | --------------------------------------------------------------------------- | ------- | ------------- |
| level | The minimum enabled logging level | string | "info" |
| disableCaller | Stops annotating logs with the calling function's file name and line number | boolean | true |
| disableStacktrace | Disables automatic stacktrace capturing | boolean | false |
| stacktraceLevel | The level stacktraces are captured and above | string | "panic" |
| encoding | The logger's encoding (options: "json", "console") | string | "console" |
| [encodingConfig](#logger_encodingconfig) | Configuration for encodingConfig | object | |
| outputPaths | A list of URLs, file paths or stdout/stderr to write logging output to | array | stdout |
| disableEvents | Prevents log messages from being raced as events | boolean | true |

### <a id="logger_encodingconfig"></a> EncodingConfig

| Name | Description | Type | Default value |
| ----------- | ---------------------------------------------------------------------------------------------------------- | ------ | ------------- |
| timeEncoder | Sets the logger's timestamp encoding. (options: "nanos", "millis", "iso8601", "rfc3339" and "rfc3339nano") | string | "rfc3339" |
| Name | Description | Type | Default value |
| ----------- | -------------------------------------------------------------------------------------------------------------- | ------ | ------------- |
| name | The optional name of the logger instance. All log messages are prefixed with that name. | string | "" |
| level | The minimum enabled logging level | string | "info" |
| timeFormat | Sets the logger's timestamp format. (options: "rfc3339", "rfc3339nano", "datetime", "timeonly", and "iso8601") | string | "rfc3339" |
| outputPaths | A list of file paths or stdout/stderr to write logging output to | array | stdout |

Example:

```json
{
"logger": {
"name": "",
"level": "info",
"disableCaller": true,
"disableStacktrace": false,
"stacktraceLevel": "panic",
"encoding": "console",
"encodingConfig": {
"timeEncoder": "rfc3339"
},
"timeFormat": "rfc3339",
"outputPaths": [
"stdout"
],
"disableEvents": true
]
}
}
```
Expand Down
104 changes: 48 additions & 56 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,83 @@ module github.com/iotaledger/inx-dashboard

go 1.22

toolchain go1.22.0

require (
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/iancoleman/orderedmap v0.3.0
github.com/iotaledger/hive.go/app v0.0.0-20230629181801-64c530ff9d15
github.com/iotaledger/hive.go/crypto v0.0.0-20230629181801-64c530ff9d15
github.com/iotaledger/hive.go/lo v0.0.0-20230629181801-64c530ff9d15
github.com/iotaledger/hive.go/logger v0.0.0-20230629181801-64c530ff9d15
github.com/iotaledger/hive.go/runtime v0.0.0-20230629181801-64c530ff9d15
github.com/iotaledger/hive.go/web v0.0.0-20230629181801-64c530ff9d15
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230417173151-cde47df5fe79
github.com/iotaledger/inx/go v1.0.0-rc.2
github.com/iotaledger/iota.go/v3 v3.0.0-rc.3
github.com/labstack/echo/v4 v4.11.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.16.0
github.com/iotaledger/hive.go/app v0.0.0-20240419094509-31dbb7270ad9
github.com/iotaledger/hive.go/crypto v0.0.0-20240419094509-31dbb7270ad9
github.com/iotaledger/hive.go/ierrors v0.0.0-20240419094509-31dbb7270ad9
github.com/iotaledger/hive.go/lo v0.0.0-20240419094509-31dbb7270ad9
github.com/iotaledger/hive.go/log v0.0.0-20240419094509-31dbb7270ad9
github.com/iotaledger/hive.go/runtime v0.0.0-20240419094509-31dbb7270ad9
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240419094509-31dbb7270ad9
github.com/iotaledger/hive.go/web v0.0.0-20240419094509-31dbb7270ad9
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240419103152-aa12c9f5bd66
github.com/iotaledger/iota.go/v4 v4.0.0-20240419095144-054bd7d2ba61
github.com/labstack/echo/v4 v4.11.4
github.com/prometheus/client_golang v1.19.0
go.uber.org/atomic v1.11.0
go.uber.org/dig v1.17.0
golang.org/x/crypto v0.12.0
golang.org/x/time v0.3.0
nhooyr.io/websocket v1.8.7
go.uber.org/dig v1.17.1
golang.org/x/crypto v0.22.0
golang.org/x/time v0.5.0
nhooyr.io/websocket v1.8.11
)

require (
filippo.io/edwards25519 v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.3 // indirect
github.com/ethereum/go-ethereum v1.12.2 // indirect
github.com/ethereum/go-ethereum v1.13.15 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/felixge/fgprof v0.9.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/google/pprof v0.0.0-20240416155748-26353dc0451f // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/iotaledger/hive.go/constraints v0.0.0-20230629181801-64c530ff9d15 // indirect
github.com/iotaledger/hive.go/ds v0.0.0-20230629181801-64c530ff9d15 // indirect
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230417125513-e2e89991217f // indirect
github.com/iotaledger/hive.go/stringify v0.0.0-20230629181801-64c530ff9d15 // indirect
github.com/iotaledger/iota.go v1.0.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/iotaledger/hive.go/constraints v0.0.0-20240419094509-31dbb7270ad9 // indirect
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240419094509-31dbb7270ad9 // indirect
github.com/iotaledger/hive.go/ds v0.0.0-20240419094509-31dbb7270ad9 // indirect
github.com/iotaledger/hive.go/stringify v0.0.0-20240419094509-31dbb7270ad9 // indirect
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240419095729-912f1c2df45d // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/petermattis/goid v0.0.0-20230808133559-b036b712a89b // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.1 // indirect
github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.50.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 815a1a5

Please sign in to comment.