Skip to content
Permalink
Browse files

(docs): Update README and add configuration docs

Signed-off-by: Erfan Besharat <erbesharat@gmail.com>
  • Loading branch information
erbesharat committed Mar 22, 2020
1 parent 87e3624 commit 73a9542ff9159e6d432f0de4330c6647952ce64a
Showing with 109 additions and 9 deletions.
  1. +10 −3 .seed-config.yaml
  2. +10 −6 README.md
  3. +89 −0 docs/configuration.md
@@ -25,11 +25,13 @@ vision:

readme:
usageExample: |
Note: The `master` branch is using [Caddy v2](https://caddyserver.com), if you want to use Gomods with previous Caddy versions, check the caddy-v1 branch.
Gomods uses Go tools in the background for fetching the modules so there needs to be an installed version of Go on your machine.
For installing Gomods run the following command:
```
go get go.okkur.org/gomods/cmd/gomods@caddy-v1
go get go.okkur.org/gomods/cmd/gomods
```
Then you should create a config file like this example:
@@ -38,6 +40,7 @@ readme:
gomods
}
```
The example above uses the default values for Go binary and number of parallel workers.
To customize these values add these fields to your config file:
```
@@ -57,6 +60,7 @@ readme:
}
}
```
Just like `gomods` itself, cache also uses its default values when not provided.
You can specify fields like `type` and `path` to customize caching:
```
@@ -70,9 +74,12 @@ readme:
}
```
To run Gomods use the following command:
For more information about the configuration options and the JSON config
example, check the [Configuration](/docs/configuration.md) page.
To run Gomods run the following command in the same directory that the config file is located:
```
$ gomods -conf PATH_TO_CONFIG
$ gomods start
```
contributionLinks:
@@ -1,8 +1,5 @@
# Gomods

**This version supports Caddy v1 only.**
**For the latest Caddy support take a look at the latest version and code.**

Caddy plugin that provides a caching Go modules proxy with your own domain.

[![state](https://img.shields.io/badge/state-beta-blue.svg)]() [![release](https://img.shields.io/github/release/okkur/gomods.svg)](https://gomods.okkur.org/releases) [![license](https://img.shields.io/github/license/okkur/gomods.svg)](LICENSE)
@@ -14,11 +11,13 @@ It supports all the hosting services and VCS` that are supported by Go tools. It
and parallel workers to fetch and store Go modules.
## Using Gomods
Note: The `master` branch is using [Caddy v2](https://caddyserver.com), if you want to use Gomods with previous Caddy versions, check the caddy-v1 branch.
Gomods uses Go tools in the background for fetching the modules so there needs to be an installed version of Go on your machine.
For installing Gomods run the following command:
```
go get go.okkur.org/gomods/cmd/gomods@caddy-v1
go get go.okkur.org/gomods/cmd/gomods
```
Then you should create a config file like this example:
@@ -27,6 +26,7 @@ gomods.test {
gomods
}
```
The example above uses the default values for Go binary and number of parallel workers.
To customize these values add these fields to your config file:
```
@@ -46,6 +46,7 @@ gomods.test {
}
}
```
Just like `gomods` itself, cache also uses its default values when not provided.
You can specify fields like `type` and `path` to customize caching:
```
@@ -59,9 +60,12 @@ gomods.test {
}
```
To run Gomods use the following command:
For more information about the configuration options and the JSON config
example, check the [Configuration](/docs/configuration.md) page.
To run Gomods run the following command in the same directory that the config file is located:
```
$ gomods -conf PATH_TO_CONFIG
$ gomods start
```
@@ -0,0 +1,89 @@
# Configuration

Gomods has a set of default values for the config options and you can use it by
only adding the plugin name inside your config file.

Here is a example in Caddyfile format:

```
gomods.test {
gomods
}
```

## Config Options

General options:

- `gobinary`: _string_ - Path to the Go binary (Default: `/usr/bin/go`)
- `workers`: _integer_ - Number of workers for fetching the modules (Default: `1`)
- `cache`: _object_ - Cache configuration object

Cache options:

- `type`: _string_ - Cache storage type (Default: `tmp`, Options: [`local`, `tmp`])
- `path`: _string_ - Cache storage path (Default: `/tmp`)

## Examples

Caddyfile Example:

```
gomods.test {
gomods {
gobinary /my/go/binary
workers 5
cache {
type local
path /my/cache/path
}
}
}
```

JSON Example:

```json
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [":443"],
"routes": [
{
"match": [
{
"host": ["gomods.test"]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"Config": {
"cache": {
"path": "/my/cache/path",
"type": "local"
},
"gobinary": "/my/go/binary",
"workers": 5
},
"handler": "gomods"
}
]
}
]
}
]
}
]
}
}
}
}
}
```

0 comments on commit 73a9542

Please sign in to comment.
You can’t perform that action at this time.