Skip to content

Commit

Permalink
Merge pull request #742 from shauneccles/fix/improved_config_backups
Browse files Browse the repository at this point in the history
fix: respect custom config dir for config backups
  • Loading branch information
shauneccles committed Feb 14, 2024
2 parents 69d03e5 + 973c15d commit 1d2a0e7
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 77 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
if: always()
with:
name: ledfx-log-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python }}.log
path: ${{ github.workspace }}/debug_config/LedFx.log
path: ${{ github.workspace }}/debug_config/ledfx.log

build-ledfx-windows:
name: Build LedFx (Windows)
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
if: always()
with:
name: ledfx-log-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python }}.log
path: ${{ github.workspace }}/debug_config/LedFx.log
path: ${{ github.workspace }}/debug_config/ledfx.log
build-ledfx-osx:
name: Build LedFx (OS X)
runs-on: macos-latest
Expand Down Expand Up @@ -237,7 +237,7 @@ jobs:
if: always()
with:
name: ledfx-log-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python }}.log
path: ${{ github.workspace }}/debug_config/LedFx.log
path: ${{ github.workspace }}/debug_config/ledfx.log
build-ledfx-osx-m1:
name: Build LedFx (OS X) (Apple Silicon)
needs: [build-ledfx-linux, build-ledfx-windows, build-ledfx-osx]
Expand Down Expand Up @@ -309,6 +309,6 @@ jobs:
if: always()
with:
name: ledfx-log-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python }}.log
path: ${{ github.workspace }}/debug_config/LedFx.log
path: ${{ github.workspace }}/debug_config/ledfx.log


2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ What's new?

- **Dark Mode:** Choose from a few different themes for the web interface.

- **Logging:** View LedFx logs live from the web interface. Access full logs at ``~/.ledfx/LedFx.log`` (Linux/ Mac) or ``%APPDATA%/.ledfx/LedFx.log`` (Windows)
- **Logging:** View LedFx logs live from the web interface. Access full logs at ``~/.ledfx/ledfx.log`` (Linux/ Mac) or ``%APPDATA%/.ledfx/ledfx.log`` (Windows)

- **Bugfixes:** Chewing through them, slow and steady!

Expand Down
10 changes: 5 additions & 5 deletions ledfx/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from ledfx.config import (
CORE_CONFIG_SCHEMA,
WLED_CONFIG_SCHEMA,
create_backup,
migrate_config,
parse_version,
save_config,
try_create_backup,
)
from ledfx.consts import CONFIGURATION_VERSION
from ledfx.effects.audio import AudioInputSource
Expand Down Expand Up @@ -88,7 +88,7 @@ async def delete(self) -> web.Response:
Returns:
web.Response: The response indicating the success of the operation.
"""
try_create_backup("DELETE")
create_backup(self._ledfx.config_dir, "DELETE")
self._ledfx.config = CORE_CONFIG_SCHEMA({})

save_config(
Expand All @@ -98,7 +98,7 @@ async def delete(self) -> web.Response:

self._ledfx.loop.call_soon_threadsafe(self._ledfx.stop, 4)
return await self.request_success(
"success", "Config reset to default values"
"success", "Config reset to default values, LedFx restarting."
)

async def post(self, request: web.Request) -> web.Response:
Expand Down Expand Up @@ -134,9 +134,9 @@ async def post(self, request: web.Request) -> web.Response:
f"Failed to migrate import config to the new standard: {e}",
)

# if we got this far, we are happy with and commiting to the import config
# if we got this far, we are happy with and committing to the import config
# so backup the old one
try_create_backup("IMPORT")
create_backup(self._ledfx.config_dir, "IMPORT")

audio_config = AudioInputSource.AUDIO_CONFIG_SCHEMA.fget()(
config.pop("audio", {})
Expand Down
Loading

0 comments on commit 1d2a0e7

Please sign in to comment.