github.com/nilium/gitlab-runner@v12.5.0+incompatible/commands/config_unix.go (about)

     1  // +build linux darwin freebsd openbsd
     2  
     3  package commands
     4  
     5  import (
     6  	"os"
     7  	"path/filepath"
     8  
     9  	"gitlab.com/gitlab-org/gitlab-runner/helpers"
    10  )
    11  
    12  func getDefaultConfigDirectory() string {
    13  	if os.Getuid() == 0 {
    14  		return "/etc/gitlab-runner"
    15  	} else if homeDir := helpers.GetHomeDir(); homeDir != "" {
    16  		return filepath.Join(homeDir, ".gitlab-runner")
    17  	} else if currentDir := helpers.GetCurrentWorkingDirectory(); currentDir != "" {
    18  		return currentDir
    19  	}
    20  	panic("Cannot get default config file location")
    21  }