config

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config provides configuration utilities for vimp.

Key functions:

  • GetDefaultDBPath: returns default SQLite database path (~/.vimp.db)
  • RemoveSchema: strips protocol scheme from image URIs
  • GetTempFilePath: creates temporary file paths for scanner output

Database configuration:

path := config.GetDefaultDBPath() // sqlite://~/.vimp.db

Image URI handling:

// Removes docker:// or other scheme prefixes
image, _ := config.RemoveSchema("docker://redis:latest") // "redis:latest"

Index

Constants

View Source
const (
	// FileNameDefault is the default file name for the data store.
	FileNameDefault = ".vimp.db"

	// LocalStorePrefix is the prefix for local store.
	LocalStorePrefix = "sqlite://"
)

Variables

This section is empty.

Functions

func ApplyDockerMirror added in v0.9.0

func ApplyDockerMirror(imageRef string) string

ApplyDockerMirror replaces docker.io/index.docker.io with the proxy URL if set.

func GetDefaultDBPath

func GetDefaultDBPath() string

GetDefaultDBPath returns the default path for the data store.

func GetDigest added in v0.5.5

func GetDigest(v string) (string, error)

GetDigest returns the digest of the image. Could result in uri that has both a tag and a digest. Respects VIMP_DOCKER_MIRROR environment variable for Docker Hub images.

func GetDockerMirror added in v0.9.0

func GetDockerMirror() string

GetDockerMirror returns the configured Docker proxy URL. Returns empty string if not set.

func GetTempFilePath added in v0.5.4

func GetTempFilePath(prefix string) string

GetTempFilePath returns a temporary file path.

func NormalizeDockerRegistry added in v0.9.0

func NormalizeDockerRegistry(imageRef string) string

NormalizeDockerRegistry normalizes index.docker.io to docker.io for consistency.

func NormalizeImageName added in v0.7.6

func NormalizeImageName(v string) string

NormalizeImageName adds docker.io/library/ prefix to simple image names. Examples:

  • nginx -> docker.io/library/nginx
  • nginx:1.25 -> docker.io/library/nginx:1.25
  • myuser/myimage -> docker.io/myuser/myimage
  • docker.io/library/nginx -> docker.io/library/nginx (unchanged)
  • localhost:5000/myimage -> localhost:5000/myimage (unchanged, registry with port)

func RemoveSchema added in v0.5.5

func RemoveSchema(uri string) (string, error)

RemoveSchema cleans up a URI by removing the scheme (e.g., https://). Container image references like "nginx:1.25" are returned unchanged since the colon is a tag separator, not a scheme delimiter.

func RemoveTag added in v0.5.5

func RemoveTag(uri string) string

RemoveTag removes the tag from an image reference, preserving registry ports. Examples:

  • docker.io/library/nginx:1.25 -> docker.io/library/nginx
  • localhost:5000/image:tag -> localhost:5000/image
  • nginx:latest -> nginx
  • nginx -> nginx

func SetDockerMirror added in v0.9.0

func SetDockerMirror(proxy string)

SetDockerMirror sets the Docker proxy URL for Docker Hub image operations. This should be called early in application startup if the --docker-mirror flag is set.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL