Skip to content

Commit

Permalink
removed jira prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
sotomskir committed Feb 18, 2019
1 parent f202990 commit 539548c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func initConfig() {
viper.SetConfigName(".jira-cli")
}

viper.SetEnvPrefix("JIRA")
viper.SetConfigType("yaml")
viper.AutomaticEnv() // read in environment variables that match

Expand All @@ -98,5 +97,5 @@ func initConfig() {
}
viper.WriteConfigAs(path.Join(home, "/.jira-cli.yaml"))
}
jiraApi.Initialize()
jiraApi.Initialize(viper.GetString("server_url"), viper.GetString("user"), viper.GetString("password"))
}
10 changes: 5 additions & 5 deletions jiraApi/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ type Transitions struct {
Transition Transition `json:"transition,omitempty"`
}

func Initialize() {
resty.SetHostURL(viper.GetString("server_url"))
func Initialize(serverUrl string, username string, password string) {
resty.SetHostURL(serverUrl)
resty.SetTimeout(1 * time.Minute)
resty.SetBasicAuth(viper.GetString("user"), viper.GetString("password"))
resty.SetBasicAuth(username, password)
// Headers for all request
resty.SetHeader("Accept", "application/json")
resty.SetHeaders(map[string]string{
Expand Down Expand Up @@ -300,14 +300,14 @@ func TestTransitions(workflowPath string, issueKey string) {
}

func readWorkflow(workflowPath string) {
workflowContent := viper.GetString("WORKFLOW_CONTENT")
workflowContent := viper.GetString("JIRA_WORKFLOW_CONTENT")
if workflowContent != "" {
viper.MergeConfig(bytes.NewBuffer([]byte(workflowContent)))
return
}
if _, err := os.Stat(workflowPath); err != nil {
if os.IsNotExist(err) {
logger.ErrorF("File not found: %s\n", workflowPath)
logger.ErrorF("Workflow file not found: %s\n", workflowPath)
os.Exit(1)
}
}
Expand Down

0 comments on commit 539548c

Please sign in to comment.