ToDatabaseConfig "upgrades" a DbConfig to be compatible with 3.x
()
| 292 | |
| 293 | // ToDatabaseConfig "upgrades" a DbConfig to be compatible with 3.x |
| 294 | func (dbc *DbConfig) ToDatabaseConfig() *DatabaseConfig { |
| 295 | if dbc == nil { |
| 296 | return nil |
| 297 | } |
| 298 | |
| 299 | // Backwards compatibility: Continue defaulting to xattrs=false for upgraded 2.x configs (3.0+ default xattrs=true) |
| 300 | if dbc.EnableXattrs == nil { |
| 301 | dbc.EnableXattrs = base.Ptr(false) |
| 302 | } |
| 303 | |
| 304 | // Move guest out of the Users section and into its own promoted field |
| 305 | if guest, ok := dbc.Users[base.GuestUsername]; ok { |
| 306 | dbc.Guest = guest |
| 307 | delete(dbc.Users, base.GuestUsername) |
| 308 | } |
| 309 | |
| 310 | return &DatabaseConfig{ |
| 311 | cfgCas: 0, |
| 312 | DbConfig: *dbc, |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | func legacyServerAddressUpgrade(server string) (newServer, username, password string, err error) { |
| 317 | if base.ServerIsWalrus(server) { |