Skip to content

Commit

Permalink
docs: add commands overview
Browse files Browse the repository at this point in the history
  • Loading branch information
stackdumper committed Apr 18, 2019
1 parent 3aab5ff commit 6abde80
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
6 changes: 3 additions & 3 deletions proxy/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"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) {
options, err := proxy.GetOptions()
if err != nil {
Expand Down Expand Up @@ -67,7 +67,7 @@ func (proxy Proxy) GetMetadata(name string, originalPath string, header http.Hea
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) {
options, err := proxy.GetOptions()
if err != nil {
Expand All @@ -87,7 +87,7 @@ func (proxy Proxy) ListMetadata() ([]string, error) {
return deprefixedMetadata, nil
}

// Purge deletes all cached packages
// PurgeMetadata deletes all cached packages
func (proxy Proxy) PurgeMetadata() error {
options, err := proxy.GetOptions()
if err != nil {
Expand Down
37 changes: 34 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
# npm-cache-proxy
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/emeralt/npm-cache-proxy.svg?style=for-the-badge)

## Usage
...

## Configuration
- [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
...

## 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
...

## License
[MIT](./license)

0 comments on commit 6abde80

Please sign in to comment.