-
Notifications
You must be signed in to change notification settings - Fork 335
Use stdin instead of arguments for wrangler config #239
Conversation
i think this is headed in the right direction- how can i help it get across the finish line? |
I was stuck on the tests, If that looks good to you I can continue. |
@xtuc sorry for the delayed response- let's definitely finish this up |
Currently the tests are missing, they should open a |
0a85d50
to
ac1280b
Compare
c66dcf2
to
9cffd42
Compare
9cffd42
to
b313e47
Compare
b313e47
to
d25d65b
Compare
20d9e75
to
cc7782a
Compare
efb6953
to
cd52965
Compare
@@ -1,5 +1,8 @@ | |||
#![allow(clippy::redundant_closure)] | |||
|
|||
#[macro_use] | |||
extern crate text_io; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: you can get rid of this extern crate + macro use and just do a ‘use text_io::read’
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text_io
only exposes macros and if I use text_io::read!
it cannot find macro
try_read! in this scope
.
cd52965
to
f0f130d
Compare
This changes the way `wrangler config` works, previously both the email and the api_key were passed as arguments which would be captured by the terminal history. When launching the command it will prompt for an email, once stdin receive a line it will prompt for the api_key. Both lines are values and will be stored in the config. Introduce a `WRANGLER_HOME` environment variable that will configure where Wrangler defines its home directory. It will contain a `config` directory.
f0f130d
to
0054bf9
Compare
This changes the way `wrangler config` works, previously both the email and the api_key were passed as arguments which would be captured by the terminal history. When launching the command it will prompt for an email, once stdin receive a line it will prompt for the api_key. Both lines are values and will be stored in the config.
Avoid the global user config to be system readable, restrict any access to the current user (600). Extends the global_config API to allow to specify a configuration directory to create the configuration file, it's needed for testing.
@@ -42,3 +45,15 @@ fn get_global_config() -> Result<GlobalUser, failure::Error> { | |||
} | |||
} | |||
} | |||
|
|||
pub fn get_global_config_dir() -> Result<PathBuf, failure::Error> { | |||
let home_dir = if let Ok(value) = env::var("WRANGLER_HOME") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we (want to) indicate use of this env var in any of our documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it's undocumented, once this lands we can create an issue. Using XDG standarts (#221) might changes how it works.
Change global config perm
This changes the way
wrangler config
works, previously both the emailand the api_key were passed as arguments which would be captured by the
terminal history.
When launching the command it will prompt for an email, once stdin
receive a line it will prompt for the api_key. Both lines are values and
will be stored in the config.
Introduce a
WRANGLER_HOME
environment variable that will configurewhere Wrangler defines its home directory. It will contain a
config
directory.