Skip to content

Commit

Permalink
Fix nil pointer, update dev docs (#236)
Browse files Browse the repository at this point in the history
Signed-off-by: Ville Aikas <vaikas@gmail.com>
  • Loading branch information
vaikas committed Nov 8, 2021
1 parent f906984 commit 53bb400
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 29 deletions.
37 changes: 8 additions & 29 deletions config/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,41 +119,20 @@ HSM's, but to date we have only tested against a SoftHSM.

## Testing with the client

The client here is really only intended to test the `fulcio` server.

It can be run with:

```shell
go run ./cmd/client/
The easiest way to test is with [cosign tool](https://github.com/sigstore/cosign)
and using the `--fulcio-url=http://localhost:5555` flag to test against the
localhost server we set up above. A simple test would be something like this:
```
COSIGN_EXPERIMENTAL=1 ./cosign sign --fulcio-url=http://localhost:5555 ghcr.io/vaikas/task-0d6334dfa6713aace72701018aa72314@sha256:bea0dff7f02e43b0d56b3f8c6cf3ffc5de7d16c4ea4536ef2ba4ef79dc390640
```

The client defaults to a local fulcio at http://127.0.0.1:5555.
This can be overridden with the `--fulcio_address` flag.

You should see your browser open, do the oauth dance and then some output like:

```shell
$ go run ./cmd/client/
Generating ephemeral keys...
Retrieving signed certificate...
Your browser will now be opened to:
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=...

-----BEGIN CERTIFICATE-----
MIICyjCCAlCgAwIBAgITEfJ495apY+Xh6mwKJSeVKElaSjAKBggqhkjOPQQDAzAq
MRUwEwYDVQQKEwxzaWdzdG9yZS5kZXYxETAPBgNVBAMTCHNpZ3N0b3JlMB4XDTIx
MDMwNzE0NDU1N1oXDTIxMDMwNzE1MDU1MFowOjEbMBkGA1UECgwSbG9yZW5jLmRA
Z21haWwuY29tMRswGQYDVQQDDBJsb3JlbmMuZEBnbWFpbC5jb20wdjAQBgcqhkjO
PQIBBgUrgQQAIgNiAARGGPRUeASYE7ilcb59Lplt1HS21EktIc3WyUc3rVd17BZ+
OzVKUKlATQ8FZQ1Bcs5KFEQY+gDbSH/jmyA6LqNN1heIBh6vw9AoLQj/uMaocIAs
MkR2gWntT9zf2g8ysGWjggEmMIIBIjAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAww
CgYIKwYBBQUHAwMwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUH4c4aC1y99X3F+Oa
yiwx13lnwjgwHwYDVR0jBBgwFoAUyMUdAEGaJCkyUSTrDa5K7UoG0+wwgY0GCCsG
AQUFBwEBBIGAMH4wfAYIKwYBBQUHMAKGcGh0dHA6Ly9wcml2YXRlY2EtY29udGVu
dC02MDNmZTdlNy0wMDAwLTIyMjctYmY3NS1mNGY1ZTgwZDI5NTQuc3RvcmFnZS5n
b29nbGVhcGlzLmNvbS9jYTM2YTFlOTYyNDJiOWZjYjE0Ni9jYS5jcnQwHQYDVR0R
BBYwFIESbG9yZW5jLmRAZ21haWwuY29tMAoGCCqGSM49BAMDA2gAMGUCMQCsr95C
BNieKlQUj41RB9p4IB2c+8XbMK69jXm6IHZRca65nOP4nMwFUqlE1W/OnlACMAht
LTUlNndCw2IbG027fRqpElrc/IoIDBUa6aW7E1IL6gcnRk3MK38lkAg/jYaucw==
-----END CERTIFICATE-----
https://oauth2.sigstore.dev/auth/auth?access_type=online&client_id=sigstore&<SNIP>.....
```

## Compose
Expand Down
5 changes: 5 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ func load(configPath string) error {
if _, err := os.Stat(configPath); os.IsNotExist(err) {
log.Logger.Infof("No config at %s, using defaults: %v", configPath, DefaultConfig)
config = DefaultConfig
cache, err := lru.New2Q(100 /* size */)
if err != nil {
return err
}
config.lru = cache
return nil
}
b, err := ioutil.ReadFile(configPath)
Expand Down

0 comments on commit 53bb400

Please sign in to comment.