Document configuration through dotenv variables (#224)

* Format parameter table

* Format parameter keys as code

* Add documentation of configuration overrides
This commit is contained in:
Albert Wang 2023-02-01 00:26:22 -08:00 committed by GitHub
parent 439ca59b8f
commit 6d9d6acc6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 73 deletions

102
DOCS.md
View File

@ -179,79 +179,35 @@ Example configuration for passphrase which protecting a private key:
## Secret Reference
ssh_username
: account for target host user
ssh_password
: password for target host user
ssh_passphrase
: The purpose of the passphrase is usually to encrypt the private key.
ssh_key
: plain text of user private key
proxy_ssh_username
: account for user of proxy server
proxy_ssh_password
: password for user of proxy server
proxy_ssh_passphrase
: The purpose of the passphrase is usually to encrypt the private key.
proxy_ssh_key
: plain text of user private key for proxy server
| Key | Description |
|-----|-------------|
| `ssh_username` | account for target host user |
| `ssh_password` | password for target host user | |
| `ssh_passphrase` | The purpose of the passphrase is usually to encrypt the private key. |
| `ssh_key` | plain text of user private key |
| `proxy_ssh_username` | account for user of proxy server |
| `proxy_ssh_password` | password for user of proxy server |
| `proxy_ssh_passphrase` | The purpose of the passphrase is usually to encrypt the private key. |
| `proxy_ssh_key` | plain text of user private key for proxy server |
## Parameter Reference
host
: target hostname or IP
port
: ssh port of target host
username
: account for target host user
password
: password for target host user
key
: plain text of user private key
key_path
: key path of user private key
envs
: custom secrets which are made available in the script section
script
: execute commands on a remote server
script_stop
: stop script after first failure
timeout
: Timeout is the maximum amount of time for the ssh connection to establish, default is 30 seconds.
command_timeout
: Command timeout is the maximum amount of time for the execute commands, default is 10 minutes.
proxy_host
: proxy hostname or IP
proxy_port
: ssh port of proxy host
proxy_username
: account for proxy host user
proxy_password
: password for proxy host user
proxy_key
: plain text of proxy private key
proxy_key_path
: key path of proxy private key
| Key | Description |
|-----|-------------|
| `host` | target hostname or IP |
| `port` | ssh port of target host |
| `username` | account for target host user |
| `password` | password for target host user |
| `key` | plain text of user private key |
| `key_path` | key path of user private key |
| `envs` | custom secrets which are made available in the script section |
| `script` | execute commands on a remote server |
| `script_stop` | stop script after first failure |
| `timeout` | Timeout is the maximum amount of time for the ssh connection to establish, default is 30 seconds. |
| `command_timeout` | Command timeout is the maximum amount of time for the execute commands, default is 10 minutes. |
| `proxy_host` | proxy hostname or IP |
| `proxy_port` | ssh port of proxy host |
| `proxy_username` | account for proxy host user |
| `proxy_password` | password for proxy host user |
| `proxy_key` | plain text of proxy private key |
| `proxy_key_path` | key path of proxy private key |

View File

@ -110,3 +110,16 @@ pipeline:
```
See the detail of [issue comment](https://github.com/appleboy/drone-ssh/issues/51#issuecomment-336732928).
## Configuration
See [DOCS.md](./DOCS.md) for examples and full configuration options
Configuration options are loaded from multiple sources:
0. Hardcoded drone-ssh defaults. See [main.go CLI Flags](https://github.com/albertyw/drone-ssh/blob/master/main.go#L39) for more information.
1. From a `.env` [dotenv](https://github.com/joho/godotenv) file at the root of the repository tested by drone.
2. From a dotenv file at a path specified by the `PLUGIN_ENV_FILE` environment variable.
3. From your `.drone.yml` Drone configuration.
Later sources override previous sources, i.e. if `PORT` is set in an `.env` file committed in the repository or created by previous test steps, it will override the default set `main.go`.