Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ We leverage buf.io to lint and generate proto files. Make sure you [install buf]
make api
```

### Updating default values

By default CLI uses the following values for the Control Plane and Artifacts CAS API endpoints:

- Artifacts CAS: api.cas.chainloop.dev:443
Copy link
Member

@migmartri migmartri May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for another pull request (no need to block this one). To make it clear, I'd indicate that this is optional, that these values can be overridden "at runtime" on a need-to-need basis. https://github.com/chainloop-dev/chainloop#configure-cli-optional

- Control Plane API: api.cp.chainloop.dev:443

If you want to change them to your custom endpoints, you can do that at build time. We will use `ldflags` and the following variables: `defaultCASAPI` and `defaultCPAPI`. We assume in this example that we have our instance of Chainloop running at the following locations: `api.cas.acme.com:443` and `api.cp.acme.com:443`.

```
go build -ldflags "-X 'github.com/chainloop-dev/chainloop/app/cli/cmd.defaultCASAPI=api.cas.acme.com:443' -X 'github.com/chainloop-dev/chainloop/app/cli/cmd.defaultCPAPI=api.cp.acme.com:443'" app/cli/main.go
```

## Contribution guidelines

Please make sure to review the [Contribution guidelines](../../CONTRIBUTING.md) and feel free to reach out if you have any questions!
Expand Down
7 changes: 5 additions & 2 deletions app/cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ var (
flagOutputFormat string
actionOpts *action.ActionsOpts
logger zerolog.Logger
defaultCPAPI = "api.cp.chainloop.dev:443"
defaultCASAPI = "api.cas.chainloop.dev:443"
)

const useWorkflowRobotAccount = "withWorkflowRobotAccount"
Expand Down Expand Up @@ -92,11 +94,12 @@ func NewRootCmd(l zerolog.Logger) *cobra.Command {
rootCmd.SetHelpCommand(&cobra.Command{Hidden: true})

rootCmd.PersistentFlags().StringVarP(&flagCfgFile, "config", "c", "", "Path to an existing config file (default is $HOME/.config/chainloop/config.toml)")
rootCmd.PersistentFlags().String(confOptions.controlplaneAPI.flagName, "api.cp.chainloop.dev:443", "URL for the Control Plane API")

rootCmd.PersistentFlags().String(confOptions.controlplaneAPI.flagName, defaultCPAPI, "URL for the Control Plane API")
err := viper.BindPFlag(confOptions.controlplaneAPI.viperKey, rootCmd.PersistentFlags().Lookup(confOptions.controlplaneAPI.flagName))
cobra.CheckErr(err)

rootCmd.PersistentFlags().String(confOptions.CASAPI.flagName, "api.cas.chainloop.dev:443", "URL for the Artifacts Content Addressable Storage (CAS)")
rootCmd.PersistentFlags().String(confOptions.CASAPI.flagName, defaultCASAPI, "URL for the Artifacts Content Addressable Storage (CAS)")
err = viper.BindPFlag(confOptions.CASAPI.viperKey, rootCmd.PersistentFlags().Lookup(confOptions.CASAPI.flagName))
cobra.CheckErr(err)

Expand Down
1 change: 1 addition & 0 deletions devel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ You will get redirected to the pre-configured local OIDC provider (DEX) where th
- `john@chainloop.local`/`password`

Once logged in, please refer to our [Getting Started guide](https://docs.chainloop.dev/getting-started/setup) to learn how to setup an OCI registry.