Skip to content

Commit

Permalink
[MongoDB] Adding an option to disable TLS (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored Aug 5, 2024
1 parent bf52cac commit dea17ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Artie Reader reads from databases to perform historical snapshots and also reads

## Supports:

| | Snapshot | Streaming |
|------------|----------|-----------------|
| DynamoDB || |
| MongoDB || 🚧 Experimental |
| MySQL || |
| PostgreSQL || |
| SQL Server || |
| | Snapshot | Streaming |
|------------|----------|-----------|
| DynamoDB |||
| MongoDB || |
| MySQL |||
| PostgreSQL |||
| SQL Server |||


## Running
Expand Down
1 change: 1 addition & 0 deletions config/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type MongoDB struct {
Database string `yaml:"database"`
Collections []Collection `yaml:"collections"`
StreamingSettings StreamingSettings `yaml:"streamingSettings,omitempty"`
DisableTLS bool `yaml:"disableTLS"`
}

type Collection struct {
Expand Down
6 changes: 5 additions & 1 deletion sources/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ func Load(cfg config.MongoDB) (*Source, bool, error) {
Password: cfg.Password,
}

opts := options.Client().ApplyURI(cfg.Host).SetAuth(creds).SetTLSConfig(&tls.Config{})
opts := options.Client().ApplyURI(cfg.Host).SetAuth(creds)
if !cfg.DisableTLS {
opts = opts.SetTLSConfig(&tls.Config{})
}

ctx := context.Background()
client, err := mongo.Connect(ctx, opts)
if err != nil {
Expand Down

0 comments on commit dea17ce

Please sign in to comment.