nixpkgs/pkgs/by-name/gi/gitlab-shell/remove-hardcoded-locations.patch
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

49 lines
1.8 KiB
Diff

diff --git a/internal/config/config.go b/internal/config/config.go
index 36f8625..72ede08 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -12,7 +12,7 @@ import (
)
const (
- configFile = "config.yml"
+ configFile = "shell-config.yml"
defaultSecretFileName = ".gitlab_shell_secret"
)
@@ -91,7 +91,7 @@ func (c *Config) GetHttpClient() *client.HttpClient {
// NewFromDirExternal returns a new config from a given root dir. It also applies defaults appropriate for
// gitlab-shell running in an external SSH server.
func NewFromDirExternal(dir string) (*Config, error) {
- cfg, err := newFromFile(filepath.Join(dir, configFile))
+ cfg, err := newFromFile(filepath.Join("/run/gitlab", configFile))
if err != nil {
return nil, err
}
diff --git a/internal/keyline/key_line.go b/internal/keyline/key_line.go
index c6f2422..fb0426b 100644
--- a/internal/keyline/key_line.go
+++ b/internal/keyline/key_line.go
@@ -37,7 +37,7 @@ func NewPrincipalKeyLine(keyId, principal string, config *config.Config) (*KeyLi
}
func (k *KeyLine) ToString() string {
- command := fmt.Sprintf("%s %s-%s", path.Join(k.Config.RootDir, executable.BinDir, executable.GitlabShell), k.Prefix, k.ID)
+ command := fmt.Sprintf("%s %s-%s", path.Join("/run/current-system/sw/bin", executable.GitlabShell), k.Prefix, k.ID)
return fmt.Sprintf(`command="%s",%s %s`, command, SshOptions, k.Value)
}
diff --git a/support/gitlab_config.rb b/support/gitlab_config.rb
index 52ac5ee..d96baa3 100644
--- a/support/gitlab_config.rb
+++ b/support/gitlab_config.rb
@@ -7,7 +7,7 @@ class GitlabConfig
attr_reader :config
def initialize
- @config = YAML.load_file(File.join(ROOT_PATH, 'config.yml'))
+ @config = YAML.load_file('/run/gitlab/shell-config.yml')
end
def auth_file