Skip to content

Commit

Permalink
Minor bug fix + refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
OneFlyingBanana committed May 21, 2024
1 parent 0d0c420 commit 06ccca6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
4 changes: 3 additions & 1 deletion internal/replicate/replicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func (r *BasicReplicator) Replicate(ctx context.Context, image string) error {
// Probably use crane.Catalog to get a list of images in the local registry and compare to incoming image list

source := getPullSource(image)
fmt.Println("Source:", source)

if source != "" {
CopyImage(source)
}
Expand All @@ -51,7 +53,7 @@ func (r *BasicReplicator) Replicate(ctx context.Context, image string) error {
func getPullSource(image string) string {
input := os.Getenv("USER_INPUT")
if os.Getenv("SCHEME") == "https://" {
url := os.Getenv("HOST") + "/" + os.Getenv("REGISTRY") + "/" + os.Getenv("REPOSITORY") + "/" + image
url := os.Getenv("HOST") + "/" + os.Getenv("REGISTRY") + "/" + image
return url
} else {
registryInfo, err := getFileInfo(input)
Expand Down
1 change: 0 additions & 1 deletion internal/satellite/satellite.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (s *Satellite) StartZotRegistry() error {
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
fmt.Println("Command:", cmd.String())

err = cmd.Start()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion internal/store/file-fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (client *FileImageList) List(ctx context.Context) ([]Image, error) {
for _, image := range repo.Images {
// Add each "name" value to the images slice
images = append(images, Image{Name: image.Name})
fmt.Println(image.Name)
}
}

Expand Down
7 changes: 0 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,15 @@ func run() error {

// Split the host and path
hostParts := strings.Split(hostAndPath, "/")
if len(hostParts) < 2 {
fmt.Println("Invalid URL format")
}

// Set useful environment variables
host := hostParts[0]
fmt.Println("Host:", host)
os.Setenv("HOST", host)
apiVersion := hostParts[1]
fmt.Println("API Version:", apiVersion)
os.Setenv("API_VERSION", apiVersion)
registry := hostParts[2]
fmt.Println("Registry:", registry)
os.Setenv("REGISTRY", registry)
repository := hostParts[3]
fmt.Println("Repository:", repository)
os.Setenv("REPOSITORY", repository)

}
Expand Down

0 comments on commit 06ccca6

Please sign in to comment.