diff --git a/chaoscenter/graphql/server/pkg/chaoshub/service.go b/chaoscenter/graphql/server/pkg/chaoshub/service.go index fed03284b8c..98c61b98043 100644 --- a/chaoscenter/graphql/server/pkg/chaoshub/service.go +++ b/chaoscenter/graphql/server/pkg/chaoshub/service.go @@ -963,11 +963,17 @@ func (c *chaosHubService) GetChaosHubStats(ctx context.Context, projectID string func (c *chaosHubService) listDefaultHubs() *model.ChaosHub { defaultHubs := &model.ChaosHub{ - ID: DefaultHubID, - Name: "Litmus ChaosHub", - RepoURL: utils.Config.DefaultHubGitURL, - RepoBranch: utils.Config.DefaultHubBranchName, - IsDefault: true, + ID: DefaultHubID, + Name: utils.Config.DefaultHubName, + RepoURL: utils.Config.DefaultHubGitURL, + RepoBranch: utils.Config.DefaultHubBranchName, + IsPrivate: utils.Config.DefaultHubIsPrivate, + AuthType: model.AuthType(utils.Config.DefaultHubAuthType), + Token: &utils.Config.DefaultHubToken, + UserName: &utils.Config.DefaultHubUserName, + Password: &utils.Config.DefaultHubPassword, + SSHPrivateKey: &utils.Config.DefaultHubSshPrivateKey, + IsDefault: true, } return defaultHubs } @@ -978,10 +984,16 @@ func (c *chaosHubService) SyncDefaultChaosHubs() { defaultHub := c.listDefaultHubs() chartsInput := model.CloningInput{ - Name: defaultHub.Name, - RepoURL: defaultHub.RepoURL, - RepoBranch: defaultHub.RepoBranch, - IsDefault: true, + Name: defaultHub.Name, + RepoURL: defaultHub.RepoURL, + RepoBranch: defaultHub.RepoBranch, + IsPrivate: defaultHub.IsPrivate, + AuthType: defaultHub.AuthType, + Token: defaultHub.Token, + UserName: defaultHub.UserName, + Password: defaultHub.Password, + SSHPrivateKey: defaultHub.SSHPrivateKey, + IsDefault: true, } err := chaosHubOps.GitSyncDefaultHub(chartsInput) if err != nil { @@ -989,6 +1001,8 @@ func (c *chaosHubService) SyncDefaultChaosHubs() { "repoUrl": defaultHub.RepoURL, "repoBranch": defaultHub.RepoBranch, "hubName": defaultHub.Name, + "isPrivate": defaultHub.IsPrivate, + "AuthType": defaultHub.AuthType, }).WithError(err).Error("failed to sync default chaos hubs") } // Syncing Completed diff --git a/chaoscenter/graphql/server/utils/variables.go b/chaoscenter/graphql/server/utils/variables.go index 3818dc211f4..83ef3904af6 100644 --- a/chaoscenter/graphql/server/utils/variables.go +++ b/chaoscenter/graphql/server/utils/variables.go @@ -29,9 +29,16 @@ type Configuration struct { RestPort string `split_words:"true" default:"8080"` GrpcPort string `split_words:"true" default:"8000"` InfraCompatibleVersions string `required:"true" split_words:"true"` - DefaultHubGitURL string `required:"true" default:"https://github.com/litmuschaos/chaos-charts"` GitUsername string `required:"true" split_words:"true" default:"litmus"` + DefaultHubName string `required:"true" split_words:"true" default:"Litmus ChaosHub"` + DefaultHubGitURL string `required:"true" default:"https://github.com/litmuschaos/chaos-charts"` DefaultHubBranchName string `required:"true" split_words:"true"` + DefaultHubIsPrivate bool `required:"true" split_words:"true" default:"false"` + DefaultHubAuthType string `split_words:"true"` + DefaultHubToken string `split_words:"true"` + DefaultHubUserName string `split_words:"true"` + DefaultHubPassword string `split_words:"true"` + DefaultHubSshPrivateKey string `split_words:"true"` CustomChaosHubPath string `split_words:"true" default:"/tmp/"` DefaultChaosHubPath string `split_words:"true" default:"/tmp/default/"` EnableGQLIntrospection string `split_words:"true" default:"false"`