Skip to content

Commit fb1ec2b

Browse files
committed
Use generic git server URL
1 parent a03c669 commit fb1ec2b

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Configuration values can be supplied as environment variables, via a JSON config
7575
| `GBM_PROVIDER` | Git provider to use (`github` or `gitlab`). Defaults to `github`. |
7676
| `GBM_NAMESPACE` | Optional suffix added to the bookmarks repository name. |
7777
| `GBM_TITLE` | Overrides the page title shown in the browser. |
78-
| `GITLAB_SERVER` | Base URL for self-hosted GitLab, e.g. `https://gitlab.example.com` |
78+
| `GIT_SERVER` | Base URL for a self-hosted git provider, e.g. `https://gitlab.example.com` |
7979
| `GOBM_ENV_FILE` | Path to a file of `KEY=VALUE` pairs loaded before the environment. Defaults to `/etc/gobookmarks/gobookmarks.env`. |
8080
| `GOBM_CONFIG_FILE` | Path to the JSON config file. If unset the program uses `$XDG_CONFIG_HOME/gobookmarks/config.json` or `$HOME/.config/gobookmarks/config.json` for normal users and `/etc/gobookmarks/config.json` when run as root. |
8181

@@ -86,7 +86,7 @@ Use `--config <path>` or set `GOBM_CONFIG_FILE` to control which configuration f
8686

8787
The `--provider` command line flag or `GBM_PROVIDER` environment variable selects which git provider to use. By default the binary includes both GitHub and GitLab support. Use build tags `nogithub` or `nogitlab` to exclude either provider when building from source. If you specify an unknown provider the program will exit with an error listing the available options.
8888
The `--title` flag or `GBM_TITLE` environment variable sets the browser page title.
89-
Use `--gitlab-server` or `GITLAB_SERVER` to point the application at a self-hosted GitLab instance.
89+
Use `--git-server` or `GIT_SERVER` to point the application at a self-hosted git provider.
9090

9191
Running `gobookmarks --version` will print the version information along with the list of compiled-in providers.
9292
Use `--dump-config` to print the final configuration after merging the environment,

cmd/gobookmarks/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func main() {
5959
Namespace: os.Getenv("GBM_NAMESPACE"),
6060
Title: os.Getenv("GBM_TITLE"),
6161
Provider: os.Getenv("GBM_PROVIDER"),
62-
GitLabServer: os.Getenv("GITLAB_SERVER"),
62+
GitServer: os.Getenv("GIT_SERVER"),
6363
}
6464

6565
configPath := DefaultConfigPath()
@@ -71,7 +71,7 @@ func main() {
7171
var nsFlag stringFlag
7272
var titleFlag stringFlag
7373
var providerFlag stringFlag
74-
var gitlabServerFlag stringFlag
74+
var gitServerFlag stringFlag
7575
var columnFlag boolFlag
7676
var versionFlag bool
7777
var dumpConfig bool
@@ -82,7 +82,7 @@ func main() {
8282
flag.Var(&nsFlag, "namespace", "repository namespace")
8383
flag.Var(&titleFlag, "title", "site title")
8484
flag.Var(&providerFlag, "provider", fmt.Sprintf("git provider (%s)", strings.Join(ProviderNames(), ", ")))
85-
flag.Var(&gitlabServerFlag, "gitlab-server", "GitLab server base URL")
85+
flag.Var(&gitServerFlag, "git-server", "git provider base URL")
8686
flag.Var(&columnFlag, "css-columns", "use CSS columns")
8787
flag.BoolVar(&versionFlag, "version", false, "show version")
8888
flag.BoolVar(&dumpConfig, "dump-config", false, "print merged config and exit")
@@ -121,8 +121,8 @@ func main() {
121121
if columnFlag.set {
122122
cfg.CssColumns = columnFlag.value
123123
}
124-
if gitlabServerFlag.set {
125-
cfg.GitLabServer = gitlabServerFlag.value
124+
if gitServerFlag.set {
125+
cfg.GitServer = gitServerFlag.value
126126
}
127127
if providerFlag.set {
128128
cfg.Provider = providerFlag.value
@@ -137,8 +137,8 @@ func main() {
137137
UseCssColumns = cfg.CssColumns
138138
Namespace = cfg.Namespace
139139
SiteTitle = cfg.Title
140-
if cfg.GitLabServer != "" {
141-
GitLabServer = cfg.GitLabServer
140+
if cfg.GitServer != "" {
141+
GitServer = cfg.GitServer
142142
}
143143
clientID = cfg.Oauth2ClientID
144144
clientSecret = cfg.Oauth2Secret

config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type Config struct {
1818
CssColumns bool `json:"css_columns"`
1919
Namespace string `json:"namespace"`
2020
Title string `json:"title"`
21-
GitLabServer string `json:"gitlab_server"`
21+
GitServer string `json:"git_server"`
2222
}
2323

2424
// LoadConfigFile loads configuration from the given path if it exists.
@@ -55,8 +55,8 @@ func MergeConfig(dst *Config, src Config) {
5555
if src.Title != "" {
5656
dst.Title = src.Title
5757
}
58-
if src.GitLabServer != "" {
59-
dst.GitLabServer = src.GitLabServer
58+
if src.GitServer != "" {
59+
dst.GitServer = src.GitServer
6060
}
6161

6262
if src.Provider != "" {

packaging/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"css_columns": false,
66
"namespace": "",
77
"title": "",
8-
"gitlab_server": "https://gitlab.com"
8+
"git_server": "https://gitlab.com"
99
}

provider_gitlab.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
// GitLabProvider implements Provider for GitLab.
1616
//
17-
// The GitLab server URL can be overridden using the GitLabServer variable
17+
// The GitLab server URL can be overridden using the GitServer variable
1818
// defined in settings.go.
1919
type GitLabProvider struct{}
2020

@@ -23,7 +23,7 @@ func init() { RegisterProvider(GitLabProvider{}) }
2323
func (GitLabProvider) Name() string { return "gitlab" }
2424

2525
func (GitLabProvider) OAuth2Config(clientID, clientSecret, redirectURL string) *oauth2.Config {
26-
server := strings.TrimRight(GitLabServer, "/")
26+
server := strings.TrimRight(GitServer, "/")
2727
if server == "" {
2828
server = "https://gitlab.com"
2929
}
@@ -40,7 +40,7 @@ func (GitLabProvider) OAuth2Config(clientID, clientSecret, redirectURL string) *
4040
}
4141

4242
func (GitLabProvider) client(token *oauth2.Token) (*gitlab.Client, error) {
43-
server := GitLabServer
43+
server := GitServer
4444
if server == "" {
4545
server = "https://gitlab.com"
4646
}

settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ var (
44
UseCssColumns bool
55
Namespace string
66
SiteTitle string
7-
GitLabServer string = "https://gitlab.com"
7+
GitServer string = "https://gitlab.com"
88
)

0 commit comments

Comments
 (0)