A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/orgrim/pg_back/commit/9a26348fcb7112c0902c2f4d9400f46656b450bd below:

exit with error on unknown parameters in conf · orgrim/pg_back@9a26348 · GitHub

@@ -426,6 +426,59 @@ func parseCli(args []string) (options, []string, error) {

426 426

return opts, changed, nil

427 427

}

428 428 429 +

func validateConfigurationFile(cfg *ini.File) error {

430 +

s, _ := cfg.GetSection(ini.DefaultSection)

431 +

known_globals := []string{

432 +

"bin_directory", "backup_directory", "timestamp_format", "host", "port", "user",

433 +

"dbname", "exclude_dbs", "include_dbs", "with_templates", "format",

434 +

"parallel_backup_jobs", "compress_level", "jobs", "pause_timeout",

435 +

"purge_older_than", "purge_min_keep", "checksum_algorithm", "pre_backup_hook",

436 +

"post_backup_hook", "encrypt", "cipher_pass", "encrypt_keep_source",

437 +

"upload", "purge_remote", "s3_region", "s3_bucket", "s3_endpoint", "s3_profile",

438 +

"s3_key_id", "s3_secret", "s3_force_path", "s3_tls", "sftp_host",

439 +

"sftp_port", "sftp_user", "sftp_password", "sftp_directory", "sftp_identity",

440 +

"sftp_ignore_hostkey", "gcs_bucket", "gcs_endpoint", "gcs_keyfile",

441 +

"azure_container", "azure_account", "azure_key", "azure_endpoint", "pg_dump_options",

442 +

}

443 + 444 +

gkLoop:

445 +

for _, v := range s.KeyStrings() {

446 +

for _, c := range known_globals {

447 +

if v == c {

448 +

continue gkLoop

449 +

}

450 +

}

451 + 452 +

return fmt.Errorf("unknown parameter in configuration file: %s", v)

453 +

}

454 + 455 +

subs := cfg.Sections()

456 +

knonw_perdb := []string{

457 +

"format", "parallel_backup_jobs", "compress_level", "checksum_algorithm",

458 +

"purge_older_than", "purge_min_keep", "schemas", "exclude_schemas", "tables",

459 +

"exclude_tables", "pg_dump_options", "with_blobs",

460 +

}

461 + 462 +

for _, sub := range subs {

463 +

if sub.Name() == ini.DefaultSection {

464 +

continue

465 +

}

466 + 467 +

dbkLoop:

468 +

for _, v := range sub.KeyStrings() {

469 +

for _, c := range knonw_perdb {

470 +

if v == c {

471 +

continue dbkLoop

472 +

}

473 +

}

474 + 475 +

return fmt.Errorf("unknown parameter in configuration file for db %s: %s", sub.Name(), v)

476 +

}

477 +

}

478 + 479 +

return nil

480 +

}

481 + 429 482

func loadConfigurationFile(path string) (options, error) {

430 483

var format, purgeKeep, purgeInterval string

431 484

@@ -436,6 +489,10 @@ func loadConfigurationFile(path string) (options, error) {

436 489

return opts, fmt.Errorf("Could load configuration file: %v", err)

437 490

}

438 491 492 +

if err := validateConfigurationFile(cfg); err != nil {

493 +

return opts, fmt.Errorf("could not validate %s: %w", path, err)

494 +

}

495 + 439 496

s, _ := cfg.GetSection(ini.DefaultSection)

440 497 441 498

// Read all configuration parameters ensuring the destination


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4