diff --git a/cmd/hauler/cli/store/serve.go b/cmd/hauler/cli/store/serve.go index 2ef9085..44638ff 100644 --- a/cmd/hauler/cli/store/serve.go +++ b/cmd/hauler/cli/store/serve.go @@ -25,8 +25,7 @@ type ServeRegistryOpts struct { Port int RootDir string ConfigFile string - - storedir string + ReadOnly bool } func (o *ServeRegistryOpts) AddFlags(cmd *cobra.Command) { @@ -35,6 +34,7 @@ func (o *ServeRegistryOpts) AddFlags(cmd *cobra.Command) { 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.") } func ServeRegistryCmd(ctx context.Context, o *ServeRegistryOpts, s *store.Layout) error { @@ -81,8 +81,6 @@ type ServeFilesOpts struct { Port int Timeout int RootDir string - - storedir string } func (o *ServeFilesOpts) AddFlags(cmd *cobra.Command) { @@ -136,9 +134,9 @@ func (o *ServeRegistryOpts) defaultRegistryConfig() *configuration.Configuration Storage: configuration.Storage{ "cache": configuration.Parameters{"blobdescriptor": "inmemory"}, "filesystem": configuration.Parameters{"rootdirectory": o.RootDir}, - - // TODO: Ensure this is toggleable via cli arg if necessary - // "maintenance": configuration.Parameters{"readonly.enabled": false}, + "maintenance": configuration.Parameters{ + "readonly": map[any]any{"enabled": o.ReadOnly}, + }, }, }