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

Improve parsing of config paths #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

oblivioncth
Copy link

Partially streamlines the routines for loading default values, overriding them with command-line flags, and normalizing them.

Additionally allows for the use of absolute paths aside from the root path to be used without issue.

Previously FPGS would try to append all other configuration paths to
the root path, meaning that only the root path could be absolute,
while the rest were forced to be relative.

This change causes FPGS to clean, but not join, paths that are already
absolute, so that absolute paths may be used in its configuration and
on the command-line in addition to relative paths.

Path manipulation is also simplified, as multiple redundant uses of
`filepath.Abs()` + `path.Join()` were removed and replaced with
`filepath.Join()` which handles standardizing path separators and
otherwise cleaning paths to the same effect as the old method.
Uses the ServerSettings struct members as receivers for flag values
directly instead of an intermediary variable, which cuts down on
some of the boilerplate surrounding the loading of defaults via JSON
and the processing of overrides via flags.
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.

1 participant