You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "knight42 (via GitHub)" <gi...@apache.org> on 2023/03/23 12:30:19 UTC

[GitHub] [incubator-opendal] knight42 opened a new pull request, #1737: feat(oli): load config from both env and file

knight42 opened a new pull request, #1737:
URL: https://github.com/apache/incubator-opendal/pull/1737

   Per [RFC](https://github.com/apache/incubator-opendal/blob/main/core/src/docs/rfcs/0423_command_line_interface.md):
   ```
   Besides, `oil` will read profile from env like `cargo`:
   
   - `OIL_PROFILE_TEST_TYPE=s3`
   - `OIL_PROFILE_TEST_ENDPOINT=http://127.0.0.1:1090`
   - `OIL_PROFILE_TEST_BUCKET=test_bucket`
   - `OIL_PROFILE_TEST_ACCESS_KEPT_ID=access_key_id`
   - `OIL_PROFILE_TEST_SECRET_ACCESS_KEY=secret_access_key`
   ```
   
   `oli` should be able to be configured by environment variables.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] Xuanwo merged pull request #1737: feat(oli): load config from both env and file

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #1737:
URL: https://github.com/apache/incubator-opendal/pull/1737


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1737: feat(oli): load config from both env and file

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1737:
URL: https://github.com/apache/incubator-opendal/pull/1737#discussion_r1146117282


##########
bin/oli/src/config/mod.rs:
##########
@@ -31,6 +32,19 @@ pub struct Config {
 }
 
 impl Config {
+    /// Load profiles from both environment variables and local config file,
+    /// environment variables have higher precedence.
+    pub fn load<P: AsRef<Path>>(fp: P) -> Result<Config> {

Review Comment:
   Let's keep simple: `load(path: &str)` or `load(path: &Path)`



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] knight42 commented on a diff in pull request #1737: feat(oli): load config from both env and file

Posted by "knight42 (via GitHub)" <gi...@apache.org>.
knight42 commented on code in PR #1737:
URL: https://github.com/apache/incubator-opendal/pull/1737#discussion_r1146132644


##########
bin/oli/src/config/mod.rs:
##########
@@ -31,6 +32,19 @@ pub struct Config {
 }
 
 impl Config {
+    /// Load profiles from both environment variables and local config file,
+    /// environment variables have higher precedence.
+    pub fn load<P: AsRef<Path>>(fp: P) -> Result<Config> {

Review Comment:
   Done. PTAL



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org