Merge branch 'postgres-dsn-quote' of github.com:idubinskiy/terraform into idubinskiy-postgres-dsn-quote

This commit is contained in:
Sean Chittenden 2016-12-25 05:43:19 -08:00
commit 0ae84bb0a8
No known key found for this signature in database
GPG Key ID: 4EBC9DC16C2E5E16
3 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,8 @@ PSQL?=/opt/local/lib/postgresql96/bin/psql
PGDATA?=$(GOPATH)/src/github.com/hashicorp/terraform/builtin/providers/postgresql/data
initdb::
/opt/local/lib/postgresql96/bin/initdb --no-locale -U postgres -D $(PGDATA)
echo "" > pwfile
/opt/local/lib/postgresql96/bin/initdb --no-locale -U postgres -A md5 --pwfile=pwfile -D $(PGDATA)
startdb::
2>&1 \
@ -18,6 +19,7 @@ startdb::
cleandb::
rm -rf $(PGDATA)
rm -f pwfile
freshdb:: cleandb initdb startdb

View File

@ -31,7 +31,7 @@ type Client struct {
func (c *Config) NewClient() (*Client, error) {
// NOTE: dbname must come before user otherwise dbname will be set to
// user.
const dsnFmt = "host=%s port=%d dbname=%s user=%s password=%s sslmode=%s fallback_application_name=%s connect_timeout=%d"
const dsnFmt = "host='%s' port='%d' dbname='%s' user='%s' password='%s' sslmode='%s' fallback_application_name='%s' connect_timeout='%d'"
logDSN := fmt.Sprintf(dsnFmt, c.Host, c.Port, c.Database, c.Username, "<redacted>", c.SSLMode, c.ApplicationName, c.ConnectTimeoutSec)
log.Printf("[INFO] PostgreSQL DSN: `%s`", logDSN)

View File

@ -112,11 +112,10 @@ func tfAppName() string {
const VersionPrerelease = terraform.VersionPrerelease
var versionString bytes.Buffer
fmt.Fprintf(&versionString, "'Terraform v%s", terraform.Version)
fmt.Fprintf(&versionString, "Terraform v%s", terraform.Version)
if terraform.VersionPrerelease != "" {
fmt.Fprintf(&versionString, "-%s", terraform.VersionPrerelease)
}
fmt.Fprintf(&versionString, "'")
return versionString.String()
}