MakeBucketSpec creates a BucketSpec from the DatabaseConfig. Will return an error if the server value is not valid after basic parsing.
(server string)
| 104 | |
| 105 | // MakeBucketSpec creates a BucketSpec from the DatabaseConfig. Will return an error if the server value is not valid after basic parsing. |
| 106 | func (dc *DbConfig) MakeBucketSpec(server string) base.BucketSpec { |
| 107 | bc := &dc.BucketConfig |
| 108 | |
| 109 | bucketName := "" |
| 110 | tlsPort := 11207 |
| 111 | |
| 112 | // treat all walrus: as in memory storage, any persistent storage would have to be converted to rosmar |
| 113 | if strings.HasPrefix(server, "walrus:") { |
| 114 | server = rosmar.InMemoryURL |
| 115 | } |
| 116 | |
| 117 | if bc.Bucket != nil { |
| 118 | bucketName = *bc.Bucket |
| 119 | } |
| 120 | |
| 121 | if bc.KvTLSPort != 0 { |
| 122 | tlsPort = bc.KvTLSPort |
| 123 | } |
| 124 | |
| 125 | return base.BucketSpec{ |
| 126 | Server: server, |
| 127 | BucketName: bucketName, |
| 128 | Keypath: bc.KeyPath, |
| 129 | Certpath: bc.CertPath, |
| 130 | CACertPath: bc.CACertPath, |
| 131 | KvTLSPort: tlsPort, |
| 132 | Auth: bc, |
| 133 | MaxConcurrentQueryOps: bc.MaxConcurrentQueryOps, |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // Implementation of AuthHandler interface for BucketConfig |
| 138 | func (bucketConfig *BucketConfig) GetCredentials() (username string, password string, bucketname string) { |