File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ All available configurations are listed in the table below.
5353| ------------ | :--------------------- | ---------- | ------------------------------ | ------------------------------------ |
5454| ` serverUrl ` | ` CMD_CLI_SERVER_URL ` | * ` string ` * | ` https://my.codimd-domain.dev ` | The CodiMD instance URL |
5555| ` 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!_
5660
5761## Commands
5862
@@ -171,6 +175,8 @@ EXAMPLE
171175 Login as HMD successfully!
172176```
173177
178+ Alternatively, you may supply an email and password via the ` CMD_EMAIL ` and ` CMD_PASSWORD ` environment variables, respectively.
179+
174180_ See code: [ src/commands/login.ts] ( https://github.com/hackmdio/codimd-cli/blob/v1.0.3/src/commands/login.ts ) _
175181
176182### ` codimd-cli logout `
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ Login as HMD successfully!
2525 async run ( ) {
2626 const { flags} = this . parse ( Login )
2727
28- let id = flags . id
28+ let id = flags . id || process . env . CMD_CLI_ID
29+ let password = process . env . CMD_CLI_PASSWORD || ''
2930
3031 if ( ! id ) {
3132 if ( flags . ldap ) {
@@ -52,11 +53,13 @@ Login as HMD successfully!
5253 }
5354 }
5455
55- const { password} = await inquirer . prompt ( {
56+ if ( ! password ) {
57+ password = ( await inquirer . prompt ( {
5658 type : 'password' ,
5759 name : 'password' ,
5860 message : 'Enter your password'
59- } )
61+ } ) ) . password
62+ }
6063
6164 try {
6265 let success = false
You can’t perform that action at this time.
0 commit comments