Skip to content

Commit

Permalink
Merge pull request #107 from shogo82148/renamse-certificate-to-certif…
Browse files Browse the repository at this point in the history
…icates

Update variable name from Certificate to Certificates
  • Loading branch information
shogo82148 authored Mar 10, 2024
2 parents d843b8d + c98a6ed commit 2692e7f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import (
"github.com/go-sql-driver/mysql"
)

// Certificate is the certificates for connecting RDS MySQL with SSL/TLS.
// Certificates is the certificates for connecting RDS MySQL with SSL/TLS.
// It contains the intermediate and root certificates for [Amazon RDS MySQL] and [Amazon Aurora MySQL].
//
// [Amazon RDS MySQL]: https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html
// [Amazon Aurora MySQL]: https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.SSL.html
const Certificate = rdsCertificates
const Certificates = rdsCertificates

// TLSConfig is the tls.TLSConfig for connecting RDS MySQL with SSL/TLS.
var TLSConfig *tls.Config

func init() {
rootCertPool := x509.NewCertPool()
if ok := rootCertPool.AppendCertsFromPEM([]byte(Certificate)); !ok {
if ok := rootCertPool.AppendCertsFromPEM([]byte(Certificates)); !ok {
panic(errors.New("failed to append certs"))
}
TLSConfig = &tls.Config{
Expand Down
2 changes: 1 addition & 1 deletion certificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestCertificate(t *testing.T) {
t.Parallel()

pemCerts := []byte(Certificate)
pemCerts := []byte(Certificates)
for len(pemCerts) > 0 {
var block *pem.Block
block, pemCerts = pem.Decode(pemCerts)
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enable-cleartext-plugin
if err := os.WriteFile(fmt.Sprintf("%s.%d", confpath, now.UnixNano()), []byte(conf), 0600); err != nil {
return err
}
if err := os.WriteFile(fmt.Sprintf("%s.%d", pempath, now.UnixNano()), []byte(rdsmysql.Certificate), 0600); err != nil {
if err := os.WriteFile(fmt.Sprintf("%s.%d", pempath, now.UnixNano()), []byte(rdsmysql.Certificates), 0600); err != nil {
return err
}

Expand Down
6 changes: 3 additions & 3 deletions v2/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import (
"github.com/go-sql-driver/mysql"
)

// Certificate is the certificates for connecting RDS MySQL with SSL/TLS.
// Certificates is the certificates for connecting RDS MySQL with SSL/TLS.
// It contains the intermediate and root certificates for [Amazon RDS MySQL] and [Amazon Aurora MySQL].
//
// [Amazon RDS MySQL]: https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html
// [Amazon Aurora MySQL]: https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.SSL.html
const Certificate = rdsCertificates
const Certificates = rdsCertificates

// TLSConfig is the tls.TLSConfig for connecting RDS MySQL with SSL/TLS.
var TLSConfig *tls.Config

func init() {
rootCertPool := x509.NewCertPool()
if ok := rootCertPool.AppendCertsFromPEM([]byte(Certificate)); !ok {
if ok := rootCertPool.AppendCertsFromPEM([]byte(Certificates)); !ok {
panic(errors.New("failed to append certs"))
}
TLSConfig = &tls.Config{
Expand Down
2 changes: 1 addition & 1 deletion v2/certificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestCertificate(t *testing.T) {
t.Parallel()

pemCerts := []byte(Certificate)
pemCerts := []byte(Certificates)
for len(pemCerts) > 0 {
var block *pem.Block
block, pemCerts = pem.Decode(pemCerts)
Expand Down
2 changes: 1 addition & 1 deletion v2/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enable-cleartext-plugin
if err := os.WriteFile(fmt.Sprintf("%s.%d", confpath, now.UnixNano()), []byte(conf), 0600); err != nil {
return err
}
if err := os.WriteFile(fmt.Sprintf("%s.%d", pempath, now.UnixNano()), []byte(rdsmysql.Certificate), 0600); err != nil {
if err := os.WriteFile(fmt.Sprintf("%s.%d", pempath, now.UnixNano()), []byte(rdsmysql.Certificates), 0600); err != nil {
return err
}

Expand Down

0 comments on commit 2692e7f

Please sign in to comment.