Skip to content

Default configuration file#83

Merged
devgianlu merged 3 commits intodevgianlu:masterfrom
aykevl:default-config
Sep 10, 2024
Merged

Default configuration file#83
devgianlu merged 3 commits intodevgianlu:masterfrom
aykevl:default-config

Conversation

@aykevl
Copy link
Copy Markdown
Contributor

@aykevl aykevl commented Sep 8, 2024

Instead of failing altogether, this PR falls back to a default configuration file if -config_path is not set.
The default configuration file would be the equivalent of:

device_name: go-librespot <hostname>
credentials:
  type: zeroconf

If the default config file (config.yml) doesn't exist, don't exit with
an error. Instead, use a default configuration file. This removes a
small point of friction when gettting started with go-librespot.

On the other hand, if the config path is set explicitly using
`-config_path`, do exit with an error when it cannot be found (because
presumably the user made a mistake there).
This seems like a sane default, better than not setting credentials at
all which results in an error.
This makes it easier to distinguish different instances of go-librespot
on different devices.

The error is intenionally ignored: in the unlikely case that
os.Hostname() can't provide a hostname, there's no real problem and we
just use the old behavior of not providing the hostname.
@devgianlu devgianlu merged commit efe81ed into devgianlu:master Sep 10, 2024
@aykevl aykevl deleted the default-config branch September 10, 2024 10:07
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.

2 participants