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

Restructure database config #1700

Merged
merged 5 commits into from
Feb 9, 2024
Merged

Restructure database config #1700

merged 5 commits into from
Feb 9, 2024

Conversation

kradalby
Copy link
Collaborator

@kradalby kradalby commented Jan 25, 2024

This PR restructures the database part of the configuration to follow the indent style of the rest of the config. It gives a better indication for which setting belongs to sqlite and postgres.

It is intended for making adding specific features like #1583 less confusing.

The old keys are aliased to the new settings keys so this is not breaking, but marked as deprecated in the changelog so we can remove them later.

New config example:

database:
  type: sqlite3

  # SQLite config
  sqlite:
    path: /var/lib/headscale/db.sqlite

  # # Postgres config
  # postgres:
  #   # If using a Unix socket to connect to Postgres, set the socket path in the 'host' field and leave 'port' blank.
  #   type: postgres
  #   host: localhost
  #   port: 5432
  #   name: headscale
  #   user: foo
  #   pass: bar

  #   # If other 'sslmode' is required instead of 'require(true)' and 'disabled(false)', set the 'sslmode' you need
  #   # in the 'db_ssl' field. Refers to https://www.postgresql.org/docs/current/libpq-ssl.html Table 34.1.
  #   ssl: false

config-example.yaml Show resolved Hide resolved
config-example.yaml Outdated Show resolved Hide resolved
config-example.yaml Outdated Show resolved Hide resolved
@kradalby kradalby force-pushed the db-config branch 2 times, most recently from 1a149ab to 39db170 Compare January 26, 2024 11:12
Copy link
Contributor

@pallabpain pallabpain left a comment

Choose a reason for hiding this comment

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

Looks good. A few minor comments around refactoring the code for the database config.

hscontrol/types/config.go Show resolved Hide resolved
hscontrol/app.go Outdated Show resolved Hide resolved
kradalby and others added 5 commits February 8, 2024 17:33
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@dalby.cc>
@kradalby kradalby merged commit 94b30ab into juanfont:main Feb 9, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants