mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 08:02:18 +02:00
Fix tests, update README.md
This commit is contained in:
parent
42896b3711
commit
145d88f39b
26
README.md
26
README.md
@ -31,20 +31,18 @@ path = "/etc/drone/drone.db"
|
||||
[docker]
|
||||
cert = ""
|
||||
key = ""
|
||||
nodes = [
|
||||
"unix:///var/run/docker.sock",
|
||||
"unix:///var/run/docker.sock"
|
||||
]
|
||||
addr = "unix:///var/run/docker.sock"
|
||||
swarm = ""
|
||||
|
||||
[service]
|
||||
name = "github"
|
||||
kind = "github"
|
||||
base = "https://github.com"
|
||||
orgs = []
|
||||
open = false
|
||||
private_mode = false
|
||||
private = false
|
||||
skip_verify = true
|
||||
|
||||
[service.oauth]
|
||||
[auth]
|
||||
client = ""
|
||||
secret = ""
|
||||
authorize = "https://github.com/login/oauth/authorize"
|
||||
@ -54,3 +52,17 @@ request_token = ""
|
||||
[agents]
|
||||
secret = ""
|
||||
```
|
||||
|
||||
Configuration settings can also be set by environment variables using the scheme `DRONE_<section>_<confkey>`, substituting the section title for `<section>` and the key for `<confkey>`, in all caps. For example:
|
||||
|
||||
```shell
|
||||
#!/bin/bash
|
||||
# prepare environment for executing drone
|
||||
DRONE_DOCKER_ADDR="tcp://10.0.0.1:2375" # for [docker] section, 'addr' setting
|
||||
DRONE_AUTH_CLIENT="0123456789abcdef0123AA" # for [auth] section, 'client' setting
|
||||
DRONE_AUTH_SECRET="<sha-1 hash secret>" # for [auth] section, 'secret' setting
|
||||
|
||||
exec bin/drone -config=drone.toml
|
||||
```
|
||||
|
||||
_NOTE: Configuration settings from environment variables override values set in the TOML file._
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
. "github.com/drone/drone/Godeps/_workspace/src/github.com/franela/goblin"
|
||||
"github.com/drone/drone/Godeps/_workspace/src/github.com/gin-gonic/gin"
|
||||
"github.com/drone/drone/Godeps/_workspace/src/github.com/stretchr/testify/mock"
|
||||
"github.com/drone/drone/pkg/config"
|
||||
"github.com/drone/drone/pkg/server/recorder"
|
||||
"github.com/drone/drone/pkg/server/session"
|
||||
"github.com/drone/drone/pkg/settings"
|
||||
"github.com/drone/drone/pkg/store/mock"
|
||||
"github.com/drone/drone/pkg/types"
|
||||
)
|
||||
@ -60,9 +60,10 @@ func TestToken(t *testing.T) {
|
||||
ctx.Set("datastore", store)
|
||||
ctx.Set("user", &types.User{Login: "Freya"})
|
||||
|
||||
config := settings.Settings{Session: &settings.Session{Secret: "Otto"}}
|
||||
ctx.Set("settings", &config)
|
||||
ctx.Set("session", session.New(config.Session))
|
||||
conf := &config.Config{}
|
||||
conf.Session.Secret = "Otto"
|
||||
ctx.Set("settings", conf)
|
||||
ctx.Set("session", session.New(conf))
|
||||
|
||||
// prepare the mock
|
||||
store.On("AddToken", mock.AnythingOfType("*types.Token")).Return(test.storeErr).Once()
|
||||
@ -98,9 +99,10 @@ func TestToken(t *testing.T) {
|
||||
ctx.Set("datastore", store)
|
||||
ctx.Set("user", &types.User{Login: "Freya"})
|
||||
|
||||
config := settings.Settings{Session: &settings.Session{Secret: "Otto"}}
|
||||
ctx.Set("settings", &config)
|
||||
ctx.Set("session", session.New(config.Session))
|
||||
conf := &config.Config{}
|
||||
conf.Session.Secret = "Otto"
|
||||
ctx.Set("settings", conf)
|
||||
ctx.Set("session", session.New(conf))
|
||||
|
||||
// prepare the mock
|
||||
store.On("TokenLabel", mock.AnythingOfType("*types.User"), test.inLabel).Return(test.outToken, test.errTokenLabel).Once()
|
||||
|
Loading…
Reference in New Issue
Block a user