Skip to content

Commit

Permalink
Fix: move storage to "storage" folder, to avoid docker conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Dec 18, 2019
1 parent ac022be commit 7323ed9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Routing setups can be stored in STORAGE. So it´s possible to have different Rou
### Run as Docker: (On linux)
```
docker pull olzzon/sisyfos-audio-controller:develop
sudo docker run --mount source=sisyfos-vol,target=/opt/sisyfos-audio-controller --network="host" --restart unless-stopped olzzon/sisyfos-audio-controller:develop
docker volume create sisyfos-vol
sudo docker run --mount source=sisyfos-vol,target=/opt/sisyfos-audio-controller/storage --network="host" --restart unless-stopped olzzon/sisyfos-audio-controller:develop
```

### Install Local node host:
Expand Down
4 changes: 2 additions & 2 deletions server/MainApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MainApp {
global.mixerProtocol.channelTypes.forEach((item: any, index: number) => {
this.numberOfChannels.push(this.store.settings[0].numberOfChannelsInType[index]);
});
this.loadSnapshotSettings(path.resolve('default.shot'), true)
this.loadSnapshotSettings(path.resolve('storage', 'default.shot'), true)

// ** UNCOMMENT TO DUMP A FULL STORE:
//const fs = require('fs')
Expand All @@ -45,7 +45,7 @@ export class MainApp {
faderState: this.store.faders[0],
channelState: this.store.channels[0]
}
saveSnapshotState(snapshot, path.resolve(this.settingsPath, 'default.shot'))
saveSnapshotState(snapshot, path.resolve(this.settingsPath, 'storage', 'default.shot'))
},
2000);
}
Expand Down
4 changes: 2 additions & 2 deletions server/MainThreadHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ export class MainThreadHandlers {
.on(SOCKET_LOAD_SNAPSHOT, (
(payload: string) => {
console.log('Load Snapshot')
global.mainApp.loadSnapshotSettings(path.resolve(payload), false)
global.mainApp.loadSnapshotSettings(path.resolve('storage', payload), false)
global.socketServer.emit('set-store', global.storeRedux.getState())
})
)
.on(SOCKET_SAVE_SNAPSHOT, (
(payload: string) => {
console.log('Save Snapshot')
global.mainApp.saveSnapshotSettings(path.resolve(payload))
global.mainApp.saveSnapshotSettings(path.resolve('storage', payload))

global.socketServer.emit(
SOCKET_RETURN_SNAPSHOT_LIST,
Expand Down
6 changes: 3 additions & 3 deletions server/utils/SettingsStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const loadSettings = (storeRedux: any) => {
// console.log('SETTINGS IS LOADING')
let settingsInterface = storeRedux.settings[0];
try {
return (JSON.parse(fs.readFileSync(path.resolve("settings.json"))))
return (JSON.parse(fs.readFileSync(path.resolve('storage', 'settings.json'))))
}
catch (error) {
saveSettings(settingsInterface);
Expand All @@ -21,7 +21,7 @@ export const loadSettings = (storeRedux: any) => {

export const saveSettings = (settings: any) => {
let json = JSON.stringify(settings);
fs.writeFile(path.resolve("settings.json"), json, 'utf8', (error: any)=>{
fs.writeFile(path.resolve('storage', 'settings.json'), json, 'utf8', (error: any)=>{
console.log(error);
});
};
Expand Down Expand Up @@ -85,7 +85,7 @@ export const saveSnapshotState = (stateSnapshot: any, fileName: string) => {
}

export const getSnapShotList = () => {
const files = fs.readdirSync(path.resolve()).filter((file: string) => {
const files = fs.readdirSync(path.resolve('storage')).filter((file: string) => {
if (file.includes('.shot') && file !== 'default.shot') {
return true
}
Expand Down

0 comments on commit 7323ed9

Please sign in to comment.