Skip to content

Commit 6abde80

Browse files
committed
docs: add commands overview
1 parent 3aab5ff commit 6abde80

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

proxy/cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
)
88

9-
// GetMetadata returns NPM response for a given package path
9+
// GetMetadata returns cached NPM response for a given package path
1010
func (proxy Proxy) GetMetadata(name string, originalPath string, header http.Header) ([]byte, error) {
1111
options, err := proxy.GetOptions()
1212
if err != nil {
@@ -67,7 +67,7 @@ func (proxy Proxy) GetMetadata(name string, originalPath string, header http.Hea
6767
return []byte(pkg), nil
6868
}
6969

70-
// ListMetadata returns a list of all cached packages
70+
// ListMetadata returns list of all cached packages
7171
func (proxy Proxy) ListMetadata() ([]string, error) {
7272
options, err := proxy.GetOptions()
7373
if err != nil {
@@ -87,7 +87,7 @@ func (proxy Proxy) ListMetadata() ([]string, error) {
8787
return deprefixedMetadata, nil
8888
}
8989

90-
// Purge deletes all cached packages
90+
// PurgeMetadata deletes all cached packages
9191
func (proxy Proxy) PurgeMetadata() error {
9292
options, err := proxy.GetOptions()
9393
if err != nil {

readme.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,42 @@
11
# npm-cache-proxy
22
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/emeralt/npm-cache-proxy.svg?style=for-the-badge)
33

4-
## Usage
5-
...
64

7-
## Configuration
5+
- [npm-cache-proxy](#npm-cache-proxy)
6+
- [Download](#download)
7+
- [Usage](#usage)
8+
- [`ncp`](#ncp)
9+
- [`ncp list`](#ncp-list)
10+
- [`ncp purge`](#ncp-purge)
11+
- [Programmatic usage](#programmatic-usage)
12+
- [License](#license)
13+
14+
## Download
815
...
916

17+
## Usage
18+
19+
### `ncp`
20+
Start proxy server.
21+
22+
| Options | Env | Default | Description |
23+
| ------------------------- | ------------- | ----------------------- | --------------------------- |
24+
| `-p, --port <port>` | `HTTP_PORT` | `8080` | Port to listen to |
25+
| `-l, --limit <count>` | `CACHE_LIMIT` | - | Cached packages count limit |
26+
| `-t, --ttl <timeout>` | `CACHE_TTL` | `3600` | Cache expiration timeout |
27+
| `-h, --host <address>` | `REDIS_HOST` | `http://localhost:6379` | Redis address |
28+
| `-d, --db <database>` | `REDIS_DB` | `0` | Redis database |
29+
| `-a, --access <password>` | `REDIS_PASS` | - | Redis password |
30+
31+
32+
### `ncp list`
33+
List cached packages.
34+
35+
### `ncp purge`
36+
Purge cached pacakges.
37+
1038
## Programmatic usage
1139
...
40+
41+
## License
42+
[MIT](./license)

0 commit comments

Comments
 (0)