refactor: move registry path to const
This commit is contained in:
@@ -32,6 +32,8 @@ var (
|
||||
|
||||
const KubeConfigPath = "/etc/rancher/k3s/k3s.yaml"
|
||||
|
||||
const RegistryConfigPath = "/etc/rancher/k3s/registries.yaml"
|
||||
|
||||
var (
|
||||
runtimeScheme = runtime.NewScheme()
|
||||
codecs = serializer.NewCodecFactory(runtimeScheme)
|
||||
|
||||
@@ -76,7 +76,7 @@ func CommandInitialize() error {
|
||||
return fmt.Errorf("Error installing k3s: %w", installerCmd.ExitError)
|
||||
}
|
||||
|
||||
if err := common.TouchFile("/etc/rancher/k3s/registries.yaml"); err != nil {
|
||||
if err := common.TouchFile(RegistryConfigPath); err != nil {
|
||||
return fmt.Errorf("Error creating initial registries.yaml file")
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func CommandInitialize() error {
|
||||
"setfacl",
|
||||
"-m",
|
||||
"user:dokku:rwx",
|
||||
"/etc/rancher/k3s/registries.yaml",
|
||||
RegistryConfigPath,
|
||||
}, " "))
|
||||
if !registryAclCmd.Execute() {
|
||||
return fmt.Errorf("Error updating acls on k3s registries.yaml file: %w", registryAclCmd.ExitError)
|
||||
|
||||
@@ -85,8 +85,7 @@ func TriggerPostRegistryLogin(server string, username string, password string) e
|
||||
}
|
||||
|
||||
registry := registries.Registry{}
|
||||
registryFile := "/etc/rancher/k3s/registries.yaml"
|
||||
yamlFile, err := os.ReadFile(registryFile)
|
||||
yamlFile, err := os.ReadFile(RegistryConfigPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to read existing registries.yaml: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user