docs: add commands overview
This commit is contained in:
parent
3aab5ffc47
commit
6abde80d35
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetMetadata returns NPM response for a given package path
|
// GetMetadata returns cached NPM response for a given package path
|
||||||
func (proxy Proxy) GetMetadata(name string, originalPath string, header http.Header) ([]byte, error) {
|
func (proxy Proxy) GetMetadata(name string, originalPath string, header http.Header) ([]byte, error) {
|
||||||
options, err := proxy.GetOptions()
|
options, err := proxy.GetOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -67,7 +67,7 @@ func (proxy Proxy) GetMetadata(name string, originalPath string, header http.Hea
|
||||||
return []byte(pkg), nil
|
return []byte(pkg), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListMetadata returns a list of all cached packages
|
// ListMetadata returns list of all cached packages
|
||||||
func (proxy Proxy) ListMetadata() ([]string, error) {
|
func (proxy Proxy) ListMetadata() ([]string, error) {
|
||||||
options, err := proxy.GetOptions()
|
options, err := proxy.GetOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -87,7 +87,7 @@ func (proxy Proxy) ListMetadata() ([]string, error) {
|
||||||
return deprefixedMetadata, nil
|
return deprefixedMetadata, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purge deletes all cached packages
|
// PurgeMetadata deletes all cached packages
|
||||||
func (proxy Proxy) PurgeMetadata() error {
|
func (proxy Proxy) PurgeMetadata() error {
|
||||||
options, err := proxy.GetOptions()
|
options, err := proxy.GetOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
37
readme.md
37
readme.md
|
@ -1,11 +1,42 @@
|
||||||
# npm-cache-proxy
|
# npm-cache-proxy
|
||||||
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/emeralt/npm-cache-proxy.svg?style=for-the-badge)
|
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/emeralt/npm-cache-proxy.svg?style=for-the-badge)
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
- [npm-cache-proxy](#npm-cache-proxy)
|
||||||
|
- [Download](#download)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [`ncp`](#ncp)
|
||||||
|
- [`ncp list`](#ncp-list)
|
||||||
|
- [`ncp purge`](#ncp-purge)
|
||||||
|
- [Programmatic usage](#programmatic-usage)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
## Download
|
||||||
...
|
...
|
||||||
|
|
||||||
## Configuration
|
## Usage
|
||||||
...
|
|
||||||
|
### `ncp`
|
||||||
|
Start proxy server.
|
||||||
|
|
||||||
|
| Options | Env | Default | Description |
|
||||||
|
| ------------------------- | ------------- | ----------------------- | --------------------------- |
|
||||||
|
| `-p, --port <port>` | `HTTP_PORT` | `8080` | Port to listen to |
|
||||||
|
| `-l, --limit <count>` | `CACHE_LIMIT` | - | Cached packages count limit |
|
||||||
|
| `-t, --ttl <timeout>` | `CACHE_TTL` | `3600` | Cache expiration timeout |
|
||||||
|
| `-h, --host <address>` | `REDIS_HOST` | `http://localhost:6379` | Redis address |
|
||||||
|
| `-d, --db <database>` | `REDIS_DB` | `0` | Redis database |
|
||||||
|
| `-a, --access <password>` | `REDIS_PASS` | - | Redis password |
|
||||||
|
|
||||||
|
|
||||||
|
### `ncp list`
|
||||||
|
List cached packages.
|
||||||
|
|
||||||
|
### `ncp purge`
|
||||||
|
Purge cached pacakges.
|
||||||
|
|
||||||
## Programmatic usage
|
## Programmatic usage
|
||||||
...
|
...
|
||||||
|
|
||||||
|
## License
|
||||||
|
[MIT](./license)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user