Skip to content

OpenRegistry binary panics if config.yaml is missing few fields #118

@jay-dee7

Description

@jay-dee7

Describe the bug
When I try to run OpenRegistry, without editing the default config.yaml, it panics. A better alternative could be to handle this error properly.

To Reproduce

cp config.yaml.example config.yaml

Expected behavior
When some configuration variables are missing in config.yaml file, we should throw an error and let the runner know what's going wrong.

Screenshots
nil

Log Files

…/OpenRegistry on 🌱 master [🤷] via ‍🏎💨 v1.17.8 on ☁️  (eu-west-1)
✗  cp config.yaml.example config.yaml

…/OpenRegistry on 🌱 master [🤷] via ‍🏎💨 v1.17.8 on ☁️  (eu-west-1)
➜  ./OpenRegistry
badger 2022/03/11 06:03:24 INFO: All 0 tables opened in 0s
badger 2022/03/11 06:03:24 INFO: Discard stats nextEmptySlot: 0
badger 2022/03/11 06:03:24 INFO: Set nextTxnTs to 0
badger 2022/03/11 06:03:24 INFO: Deleting empty file: .kvstore/000050.vlog
connection to database successful
badger 2022/03/11 06:03:24 INFO: Lifetime L0 stalled for: 0s
badger 2022/03/11 06:03:24 INFO:
Level 0 [ ]: NumTables: 00. Size: 0 B of 0 B. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 64 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 4 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 5 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 6 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level Done
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x10145990c]

goroutine 1 [running]:
github.com/containerish/OpenRegistry/auth.New({0x10181d4d8, 0x14000092058}, 0x140002655e0, {0x101821e30, 0x14000092208}, {0x10181f9f8, 0x14000150480})
        /Users/jasdeep/oss/OpenRegistry/auth/auth.go:50 +0xac
main.main()
        /Users/jasdeep/oss/OpenRegistry/main.go:47 +0x308

…/OpenRegistry on 🌱 master [🤷] via ‍🏎💨 v1.17.8 on ☁️  (eu-west-1)
✗

Desktop (please complete the following information):

  • OS: MacOS
  • Version: 12.3

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

P3P3 labels are used for issues which are not very pressing and we'd love community to work onbugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions