MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / defaultInitDB

Method defaultInitDB

api/v1/cluster_defaults.go:234–261  ·  view source on GitHub ↗

defaultInitDB enriches the initDB with defaults if not all the required arguments were passed

()

Source from the content-addressed store, hash-verified

232
233// defaultInitDB enriches the initDB with defaults if not all the required arguments were passed
234func (r *Cluster) defaultInitDB() {
235 if r.Spec.Bootstrap.InitDB == nil {
236 r.Spec.Bootstrap.InitDB = &BootstrapInitDB{
237 Database: DefaultApplicationDatabaseName,
238 Owner: DefaultApplicationUserName,
239 }
240 }
241
242 if r.Spec.Bootstrap.InitDB.Database == "" {
243 // Set the default only if not executing a monolithic import
244 if r.Spec.Bootstrap.InitDB.Import == nil ||
245 r.Spec.Bootstrap.InitDB.Import.Type != MonolithSnapshotType {
246 r.Spec.Bootstrap.InitDB.Database = DefaultApplicationDatabaseName
247 }
248 }
249 if r.Spec.Bootstrap.InitDB.Owner == "" {
250 r.Spec.Bootstrap.InitDB.Owner = r.Spec.Bootstrap.InitDB.Database
251 }
252 if r.Spec.Bootstrap.InitDB.Encoding == "" {
253 r.Spec.Bootstrap.InitDB.Encoding = "UTF8"
254 }
255 if r.Spec.Bootstrap.InitDB.LocaleCollate == "" {
256 r.Spec.Bootstrap.InitDB.LocaleCollate = "C"
257 }
258 if r.Spec.Bootstrap.InitDB.LocaleCType == "" {
259 r.Spec.Bootstrap.InitDB.LocaleCType = "C"
260 }
261}
262
263// defaultRecovery enriches the recovery with defaults if not all the required arguments were passed
264func (r *Cluster) defaultRecovery() {

Callers 1

setDefaultsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected