Skip to content

Commit

Permalink
[FEAT] adding repo proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Takashi <[email protected]>
  • Loading branch information
nicolastakashi committed Feb 24, 2022
1 parent a82b47a commit bbeb41e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.4.0
1 change: 1 addition & 0 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func init() {
syncCmd.Flags().StringVar(&pcmd.Repository.Auth.Username, "repository.auth.username", "", "username to perform authentication")
syncCmd.Flags().StringVar(&pcmd.Repository.Auth.Password, "repository.auth.password", "", "password to perform authentication")
syncCmd.Flags().StringVar(&pcmd.Repository.Branch, "repository.branch", "main", "path to clone the git repository")
syncCmd.Flags().StringVar(&pcmd.Repository.Proxy, "repository.proxy", "", "https proxy url")
syncCmd.Flags().StringVar(&pcmd.Namespace, "namespace", "default", "namespace that will store the dashboard config map")
syncCmd.Flags().StringVar(&pcmd.DashboardLabels, "dashboard.labels", "grafana_dashboard=nil", "dashboard label selector")
syncCmd.Flags().StringVar(&pcmd.DashboardFolderAnnotation, "dashboard.folder-annotation", "", "dashboard folder annotation")
Expand Down
8 changes: 5 additions & 3 deletions internal/gitmanager/gitmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Repository struct {
Url string
Path string
Branch string
Proxy string
DashboardPath string
Auth RepositoryAuth
}
Expand Down Expand Up @@ -56,10 +57,11 @@ func (r Repository) Validate() error {
}

func (r *Repository) Get(ctx context.Context) (bool, error) {
if httpsProxy := os.Getenv("HTTPS_PROXY"); httpsProxy != "" {
logrus.Debugf("using proxy %v", httpsProxy)

proxyUrl, err := url.Parse(httpsProxy)
if r.Proxy != "" {
logrus.Debugf("using proxy %v", r.Proxy)

proxyUrl, err := url.Parse(r.Proxy)

if err != nil {
return false, err
Expand Down

0 comments on commit bbeb41e

Please sign in to comment.