Skip to content

Commit

Permalink
CLI: set localhost as default for database hostname in verdi setup (
Browse files Browse the repository at this point in the history
#4908)

The default was actually being defined on the option, however, it was
taken from the `pgsu.DEFAULT_DSN` dictionary, which defines the database
hostname to be `None`. Still, 9 out of 10 times the database is on the
localhost so not having this as a default is kind of annoying and
unnecessary.

Note that `pgsu` specifies `None` as the default because this is at times
the only way the psql shell can be accessed without a password.

Cherry-pick: 6c4ced3
  • Loading branch information
sphuber committed Aug 8, 2021
1 parent ea08445 commit 21c8743
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aiida/cmdline/params/options/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def decorator(command):
'--db-host',
type=types.HostnameType(),
help='Database server host. Leave empty for "peer" authentication.',
default=DEFAULT_DBINFO['host']
default='localhost'
)

DB_PORT = OverridableOption(
Expand Down
2 changes: 1 addition & 1 deletion aiida/cmdline/params/options/commands/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def get_quicksetup_password(ctx, param, value): # pylint: disable=unused-argume

SETUP_DATABASE_HOSTNAME = QUICKSETUP_DATABASE_HOSTNAME.clone(
prompt='Database host',
contextual_default=functools.partial(get_profile_attribute_default, ('database_hostname', DEFAULT_DBINFO['host'])),
contextual_default=functools.partial(get_profile_attribute_default, ('database_hostname', 'localhost')),
cls=options.interactive.InteractiveOption
)

Expand Down

0 comments on commit 21c8743

Please sign in to comment.