diff --git a/README.md b/README.md index 78ca0403..bc6812fb 100644 --- a/README.md +++ b/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_
_`, substituting the section title for `
` and the key for ``, 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="" # for [auth] section, 'secret' setting + +exec bin/drone -config=drone.toml +``` + +_NOTE: Configuration settings from environment variables override values set in the TOML file._ diff --git a/pkg/server/token_test.go b/pkg/server/token_test.go index 628e0b4d..9fb7c537 100644 --- a/pkg/server/token_test.go +++ b/pkg/server/token_test.go @@ -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()