From 001e6c9f5f87d66bc81978ccc8f23a004c1644e9 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Mon, 3 Aug 2015 22:46:58 -0700 Subject: [PATCH 1/2] fixed incorrect docs, removed toml depdendency --- doc/setup/mysql.md | 4 ++-- doc/setup/postgres.md | 4 ++-- doc/setup/sqlite.md | 6 +++--- pkg/config/config.go | 8 +------- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/doc/setup/mysql.md b/doc/setup/mysql.md index 2cd2109a..380cf76f 100644 --- a/doc/setup/mysql.md +++ b/doc/setup/mysql.md @@ -5,8 +5,8 @@ Drone comes with support for MySQL as an alternate database engine. To enable Postgres, you should specify the following environment variables: ``` -DATASTORE_DRIVER="mysql" -DATASTORE_CONFIG="root:pa55word@tcp(localhost:3306)/drone" +DATABASE_DRIVER="mysql" +DATABASE_DATASOURCE="root:pa55word@tcp(localhost:3306)/drone" ``` ## MySQL connection diff --git a/doc/setup/postgres.md b/doc/setup/postgres.md index 24af892c..fb4ddcaf 100644 --- a/doc/setup/postgres.md +++ b/doc/setup/postgres.md @@ -4,8 +4,8 @@ Drone comes with support for Postgres as an alternate database engine. To enable Postgres, you should specify the following environment variables: ``` -DATASTORE_DRIVER="postgres" -DATASTORE_CONFIG="postgres://root:pa55word@127.0.0.1:5432/postgres" +DATABASE_DRIVER="postgres" +DATABASE_DATASOURCE="postgres://root:pa55word@127.0.0.1:5432/postgres" ``` ## Postgres connection diff --git a/doc/setup/sqlite.md b/doc/setup/sqlite.md index 31fadf63..473541c3 100644 --- a/doc/setup/sqlite.md +++ b/doc/setup/sqlite.md @@ -3,13 +3,13 @@ Drone uses SQLite as the default database with zero configuration required. In order to customize the SQLite database configuration you should specify the following environment variables: ``` -DATASTORE_DRIVER="sqlite3" -DATASTORE_CONFIG="/var/lib/drone/drone.sqlite" +DATABASE_DRIVER="sqlite3" +DATABASE_DATASOURCE="/var/lib/drone/drone.sqlite" ``` ## Sqlite3 connection -The components of this connection string are: +The components of the datasource connection string are: * `path` local path to sqlite database. The default value is `/var/lib/drone/drone.sqlite`. diff --git a/pkg/config/config.go b/pkg/config/config.go index 0dcd610b..fbe55ca6 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -2,13 +2,11 @@ package config import ( "fmt" - "io/ioutil" "os" "path" "strings" log "github.com/drone/drone/Godeps/_workspace/src/github.com/Sirupsen/logrus" - // "github.com/drone/drone/Godeps/_workspace/src/github.com/naoina/toml" "github.com/drone/drone/Godeps/_workspace/src/github.com/vrischmann/envconfig" ) @@ -98,11 +96,7 @@ type Config struct { // Load loads the configuration file and reads // parameters from environment variables. func Load(path string) (*Config, error) { - data, err := ioutil.ReadFile(path) - if err != nil { - return nil, err - } - return LoadBytes(data) + return LoadBytes([]byte{}) } // LoadBytes reads the configuration file and From c8405bfd2b1677866d5e33aa9fd5e4240c183b4b Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 4 Aug 2015 10:55:27 -0700 Subject: [PATCH 2/2] add cache to yaml --- README.md | 4 ++-- pkg/types/config.go | 1 + pkg/utils/sshutil/sshutil.go | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd049a84..edd069e4 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,6 @@ Drone documentation is organized into several categories: * [Plugin Guide](http://readme.drone.io/docs/plugin/) * [API Reference](http://readme.drone.io/docs/api/) -### Community +### Community, Help -Contributions, questions, and comments are welcomed and encouraged. Drone developers hang out in the [drone/drone](https://gitter.im/drone/drone) room on [gitter](https://gitter.im/drone/drone). +Contributions, questions, and comments are welcomed and encouraged. Drone developers hang out in the [drone/drone](https://gitter.im/drone/drone) room on gitter. We ask that you please post your questions to [gitter](https://gitter.im/drone/drone) before creating an issue. diff --git a/pkg/types/config.go b/pkg/types/config.go index 6a431b61..7d219e58 100644 --- a/pkg/types/config.go +++ b/pkg/types/config.go @@ -47,6 +47,7 @@ type Step struct { Entrypoint []string Command []string Volumes []string + Cache []string WorkingDir string `yaml:"working_dir"` NetworkMode string `yaml:"net"` diff --git a/pkg/utils/sshutil/sshutil.go b/pkg/utils/sshutil/sshutil.go index 7def573e..197265f0 100644 --- a/pkg/utils/sshutil/sshutil.go +++ b/pkg/utils/sshutil/sshutil.go @@ -37,3 +37,16 @@ func MarshalPrivateKey(privkey *rsa.PrivateKey) []byte { privateKeyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Headers: nil, Bytes: privateKeyMarshaled}) return privateKeyPEM } + +// helper function to encrypt a plain-text string using +// an RSA public key. +func Encrypt(pubkey *rsa.PublicKey, msg string) ([]byte, error) { + return rsa.EncryptPKCS1v15(rand.Reader, pubkey, []byte(msg)) +} + +// helper function to encrypt a plain-text string using +// an RSA public key. +func Decrypt(privkey *rsa.PrivateKey, secret string) (string, error) { + msg, err := rsa.DecryptPKCS1v15(rand.Reader, privkey, []byte(secret)) + return string(msg), err +}