File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ All available configurations are listed in the table below.
53
53
| ------------ | :--------------------- | ---------- | ------------------------------ | ------------------------------------ |
54
54
| ` serverUrl ` | ` CMD_CLI_SERVER_URL ` | * ` string ` * | ` https://my.codimd-domain.dev ` | The CodiMD instance URL |
55
55
| ` cookiePath ` | ` CMD_CLI_COOKIE_PATH ` | * ` string ` * | ` ~/.codimd/cookies.json ` | File for storing login cookie states |
56
+ | _ n/a_ | ` CMD_CLI_ID ` | * ` string ` * | ` me@codimd-domain.dev ` | CodiMD username/email |
57
+ | _ n/a_ | ` CMD_CLI_PASSWORD ` | * ` string ` * | ` dragon ` | CodiMD password |
58
+
59
+ _ Don't commit your login credentials!_
56
60
57
61
## Commands
58
62
@@ -171,6 +175,8 @@ EXAMPLE
171
175
Login as HMD successfully!
172
176
```
173
177
178
+ Alternatively, you may supply an email and password via the ` CMD_EMAIL ` and ` CMD_PASSWORD ` environment variables, respectively.
179
+
174
180
_ See code: [ src/commands/login.ts] ( https://github.com/hackmdio/codimd-cli/blob/v1.0.3/src/commands/login.ts ) _
175
181
176
182
### ` codimd-cli logout `
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ Login as HMD successfully!
25
25
async run ( ) {
26
26
const { flags} = this . parse ( Login )
27
27
28
- let id = flags . id
28
+ let id = flags . id || process . env . CMD_CLI_ID
29
+ let password = process . env . CMD_CLI_PASSWORD || ''
29
30
30
31
if ( ! id ) {
31
32
if ( flags . ldap ) {
@@ -52,11 +53,13 @@ Login as HMD successfully!
52
53
}
53
54
}
54
55
55
- const { password} = await inquirer . prompt ( {
56
+ if ( ! password ) {
57
+ password = ( await inquirer . prompt ( {
56
58
type : 'password' ,
57
59
name : 'password' ,
58
60
message : 'Enter your password'
59
- } )
61
+ } ) ) . password
62
+ }
60
63
61
64
try {
62
65
let success = false
You can’t perform that action at this time.
0 commit comments