diff --git a/.gitignore b/.gitignore index da798ac7..cd7b62a4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ airgap-scp.sh dist/ tmp/ bin/ -/store/ -/registry/ +store/ +registry/ +fileserver/ cmd/hauler/binaries diff --git a/internal/flags/info.go b/internal/flags/info.go index 80b3d0ec..6f711a64 100644 --- a/internal/flags/info.go +++ b/internal/flags/info.go @@ -8,6 +8,7 @@ type InfoOpts struct { OutputFormat string TypeFilter string SizeUnit string + ListRepos bool } func (o *InfoOpts) AddFlags(cmd *cobra.Command) { @@ -15,6 +16,7 @@ func (o *InfoOpts) AddFlags(cmd *cobra.Command) { f.StringVarP(&o.OutputFormat, "output", "o", "table", "Output format (table, json)") f.StringVarP(&o.TypeFilter, "type", "t", "all", "Filter on type (image, chart, file, sigs, atts, sbom)") + f.BoolVar(&o.ListRepos, "list-repos", false, "List all repository names") // TODO: Regex/globbing } diff --git a/internal/flags/serve.go b/internal/flags/serve.go index d427d742..5a403b0e 100644 --- a/internal/flags/serve.go +++ b/internal/flags/serve.go @@ -16,20 +16,20 @@ type ServeRegistryOpts struct { ConfigFile string ReadOnly bool - TLSKey string TLSCert string + TLSKey string } func (o *ServeRegistryOpts) AddFlags(cmd *cobra.Command) { f := cmd.Flags() - f.IntVarP(&o.Port, "port", "p", 5000, "Port to listen on.") - f.StringVar(&o.RootDir, "directory", "registry", "Directory to use for backend. Defaults to $PWD/registry") - f.StringVarP(&o.ConfigFile, "config", "c", "", "Path to a config file, will override all other configs") - f.BoolVar(&o.ReadOnly, "readonly", true, "Run the registry as readonly.") + f.IntVarP(&o.Port, "port", "p", 5000, "Port used to accept incoming connections") + f.StringVar(&o.RootDir, "directory", "registry", "Directory to use for backend. Defaults to $PWD/registry") + f.StringVarP(&o.ConfigFile, "config", "c", "", "Path to config file, overrides all other flags") + f.BoolVar(&o.ReadOnly, "readonly", true, "Run the registry as readonly") - f.StringVar(&o.TLSKey, "tls-key", "", "TLS key file location.") - f.StringVar(&o.TLSCert, "tls-cert", "", "TLS cert file location.") + f.StringVar(&o.TLSCert, "tls-cert", "", "Location of the TLS Certificate") + f.StringVar(&o.TLSKey, "tls-key", "", "Location of the TLS Key") cmd.MarkFlagsRequiredTogether("tls-cert", "tls-key") } @@ -51,15 +51,14 @@ func (o *ServeRegistryOpts) DefaultRegistryConfig() *configuration.Configuration cfg.HTTP.TLS.Key = o.TLSKey } - // Add validation configuration - cfg.Validation.Manifests.URLs.Allow = []string{".+"} - - cfg.Log.Level = "info" cfg.HTTP.Addr = fmt.Sprintf(":%d", o.Port) cfg.HTTP.Headers = http.Header{ "X-Content-Type-Options": []string{"nosniff"}, } + cfg.Log.Level = "info" + cfg.Validation.Manifests.URLs.Allow = []string{".+"} + return cfg } @@ -70,19 +69,19 @@ type ServeFilesOpts struct { Timeout int RootDir string - TLSKey string TLSCert string + TLSKey string } func (o *ServeFilesOpts) AddFlags(cmd *cobra.Command) { f := cmd.Flags() - f.IntVarP(&o.Port, "port", "p", 8080, "Port to listen on.") - f.IntVarP(&o.Timeout, "timeout", "t", 60, "Set the http request timeout duration in seconds for both reads and write.") - f.StringVar(&o.RootDir, "directory", "fileserver", "Directory to use for backend. Defaults to $PWD/fileserver") + f.IntVarP(&o.Port, "port", "p", 8080, "Port used to accept incoming connections") + f.IntVarP(&o.Timeout, "timeout", "t", 60, "Timeout duration for HTTP Requests in seconds for both reads/writes") + f.StringVar(&o.RootDir, "directory", "fileserver", "Directory to use for backend. Defaults to $PWD/fileserver") - f.StringVar(&o.TLSKey, "tls-key", "", "TLS key file location.") - f.StringVar(&o.TLSCert, "tls-cert", "", "TLS cert file location.") + f.StringVar(&o.TLSCert, "tls-cert", "", "Location of the TLS Certificate") + f.StringVar(&o.TLSKey, "tls-key", "", "Location of the TLS Key") cmd.MarkFlagsRequiredTogether("tls-cert", "tls-key") }