Skip to content

Commit 748625e

Browse files
committed
Update README.md
1 parent 6040552 commit 748625e

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,71 @@ lain-upload -v
107107
- [mixdrop](https://mixdrop.ag/) - Support for user authentication with mail and API keys (**Required**).
108108
- [sharey](https://sharey.org/) - Support for custom expiration time.
109109

110+
## Configuration
111+
112+
lain-upload supports a JSON configuration file to set a default host and per-host options. You can create a default config, inspect the effective configuration, and override or ignore the config file at runtime.
113+
114+
- Default path
115+
- Linux/BSD: `$XDG_CONFIG_HOME/necraul/lain-upload.json` or `~/.config/necraul/lain-upload.json`
116+
- MacOS: `~/Library/Application Support/necraul/lain-upload.json`
117+
- Windows: `%APPDATA%/necraul/lain-upload.json`
118+
- Basic structure
119+
- `default_host`: host used when `--host` flag is omitted (default: `"catbox"`).
120+
- `hosts`: per-host configuration (`auth`, `expire_after`, `long_filenames`, etc.), keyed by host name.
121+
122+
```json
123+
{
124+
"default_host": "catbox",
125+
"hosts": {
126+
"catbox": {
127+
"auth": null
128+
},
129+
"litterbox": {
130+
"expire_after": "72h",
131+
"long_filenames": false
132+
},
133+
"gofile": {
134+
"auth": null
135+
}
136+
}
137+
}
138+
```
139+
140+
```sh
141+
# Create a default configuration file at the default path
142+
lain-upload --init-config
143+
144+
# Create a default configuration file at a custom path
145+
lain-upload --init-config config.json
146+
147+
# Show the effective configuration (defaults merged with the default config file)
148+
lain-upload --show-config
149+
150+
# Create a default configuration file at the default path and print it
151+
lain-upload --init-config --show-config
152+
153+
# Create a default configuration file at a custom path and print it
154+
lain-upload --init-config /path/to/config.json --show-config
155+
156+
# Show the effective configuration (defaults merged with the custom config file)
157+
lain-upload --config config.json --show-config
158+
159+
# Upload using the config file's default_host (no --host needed)
160+
lain-upload kuroneko.png
161+
162+
# Override the config file's default_host
163+
lain-upload --host uguu shironeko.png
164+
165+
# Use a custom configuration file
166+
lain-upload --config /path/to/config.json kamineko.png
167+
168+
# Ignore the configuration file and use only CLI flags
169+
lain-upload --no-config kuroneko.png
170+
171+
# Override config's host and expiration (CLI flag overrides config)
172+
lain-upload --host litterbox --expire-after 24h kuroneko.png
173+
```
174+
110175
## Dependencies
111176

112177
- [requests](https://github.com/psf/requests): send the API request for uploading.

0 commit comments

Comments
 (0)