Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi config support #138

Merged
merged 5 commits into from
Dec 1, 2022
Merged

Multi config support #138

merged 5 commits into from
Dec 1, 2022

Conversation

danvergara
Copy link
Owner

@danvergara danvergara commented Nov 29, 2022

Pull Request Template

Description

A user requested a very interesting feature on #137. Said feature is about to having multiple database configs, in order to have different database connection available defined in the .dblab.yaml file.

Example:

database:
  - name: "test"
    host: "localhost"
    port: 5432
    db: "users"
    password: "password"
    user: "postgres"
    schema: "public"
    driver: "postgres"
  - name: "prod"
    # example endpoint
    host: "mydb.123456789012.us-east-1.rds.amazonaws.com"
    port: 5432
    db: "users"
    password: "password"
    user: "postgres"
    schema: "public"
    driver: "postgres"
limit: 50

I agreed on the usefulness of this feature since I wanted to implemented before.
Such a change could result in a non backward compatible feature, since some users would leave the .dblab.yaml file untouched after the next update. We can permit us such proceeding since we're still under 0.X.X version though, the API is not stable yet.

The new way to consume this is:

$ dblab --config --cfg-name "prod"

--cfg-name can be omitted the default values is gonna be first item on the database array:

$ dblab --config

Fixes #137

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested it under quite a few different config files versions and scenarios.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@danvergara danvergara marked this pull request as draft November 29, 2022 03:39
@danvergara danvergara self-assigned this Nov 30, 2022
@danvergara danvergara added the kind/enhancement New feature or request label Nov 30, 2022
@danvergara danvergara marked this pull request as ready for review November 30, 2022 03:07
Copy link
Collaborator

@valerybriz valerybriz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good I think it is an excellent feature since in most of the cases we have multiple versions of the "same" DB for pre-production, production, dev, etc..

Limit int `fig:"limit" default:"100"`
}

type Database struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Copy link
Collaborator

@israteneda israteneda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! too, nice feature 🚀

@danvergara danvergara merged commit 888f544 into main Dec 1, 2022
@danvergara danvergara deleted the multi-config-support branch December 1, 2022 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] multiple "configuration" support
3 participants