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
- func ApplyDockerMirror(imageRef string) string
- func GetDefaultDBPath() string
- func GetDigest(v string) (string, error)
- func GetDockerMirror() string
- func GetTempFilePath(prefix string) string
- func NormalizeDockerRegistry(imageRef string) string
- func NormalizeImageName(v string) string
- func RemoveSchema(uri string) (string, error)
- func RemoveTag(uri string) string
- func SetDockerMirror(proxy string)
Constants ¶
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
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
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
GetTempFilePath returns a temporary file path.
func NormalizeDockerRegistry ¶ added in v0.9.0
NormalizeDockerRegistry normalizes index.docker.io to docker.io for consistency.
func NormalizeImageName ¶ added in v0.7.6
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
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
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.