From issues-return-39646-archive-asf-public=cust-asf.ponee.io@openwhisk.apache.org Thu Sep 5 09:14:28 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 62770180656 for ; Thu, 5 Sep 2019 11:14:28 +0200 (CEST) Received: (qmail 1543 invoked by uid 500); 5 Sep 2019 16:53:53 -0000 Mailing-List: contact issues-help@openwhisk.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openwhisk.apache.org Delivered-To: mailing list issues@openwhisk.apache.org Received: (qmail 1534 invoked by uid 99); 5 Sep 2019 16:53:53 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Sep 2019 16:53:53 +0000 From: GitBox To: issues@openwhisk.apache.org Subject: [GitHub] [openwhisk-wskdeploy] alvarolopez commented on a change in pull request #1054: Honor WSK_CONFIG_FILE if variable is set Message-ID: <156767486772.4542.9794250033968509747.gitbox@gitbox.apache.org> Date: Thu, 05 Sep 2019 09:14:27 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit alvarolopez commented on a change in pull request #1054: Honor WSK_CONFIG_FILE if variable is set URL: https://github.com/apache/openwhisk-wskdeploy/pull/1054#discussion_r321155044 ########## File path: cmd/root.go ########## @@ -102,21 +102,32 @@ func init() { func initConfig() { userHome := utils.GetHomeDirectory() defaultPath := path.Join(userHome, whisk.DEFAULT_LOCAL_CONFIG) - if utils.Flags.CfgFile != "" { - // Read the file as a wskprops file, to check if it is valid. - _, err := whisk.ReadProps(utils.Flags.CfgFile) - if err != nil { - utils.Flags.CfgFile = defaultPath - warn := wski18n.T(wski18n.ID_WARN_CONFIG_INVALID_X_path_X, - map[string]interface{}{ - wski18n.KEY_PATH: utils.Flags.CfgFile}) - wskprint.PrintOpenWhiskWarning(warn) + // Precedence order for reading the configuration file should be: + // 1. --config + // 2. ENV variable WSK_CONFIG_FILE + // 3. Default $HOME/.wskprops + cfgFiles := []string{ + utils.Flags.CfgFile, + os.Getenv("WSK_CONFIG_FILE"), + defaultPath, + } + + for _, cfgFile := range cfgFiles { Review comment: Well, I am not a gopher, therefore I do not know if there is any better method to perform it. What would you suggest to do? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services