-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): Check for /app/config volume mount during setup (#826)
- Loading branch information
1 parent
035534e
commit 1e5f88f
Showing
7 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { existsSync } from 'fs'; | ||
import path from 'path'; | ||
|
||
const DOCKER_PATH = path.join(__dirname, '../../config/DOCKER'); | ||
|
||
export const appDataStatus = (): boolean => { | ||
return !existsSync(DOCKER_PATH); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
import useSWR from 'swr'; | ||
import Alert from '../Common/Alert'; | ||
|
||
const messages = defineMessages({ | ||
dockerVolumeMissing: 'Docker Volume Mount Missing', | ||
dockerVolumeMissingDescription: | ||
'The <code>/app/config</code> volume mount was not configured properly. All data will be cleared when the container is stopped or restarted.', | ||
}); | ||
|
||
const AppDataWarning: React.FC = () => { | ||
const intl = useIntl(); | ||
const { data, error } = useSWR<{ appData: boolean }>( | ||
'/api/v1/status/appdata' | ||
); | ||
|
||
if (!data && !error) { | ||
return null; | ||
} | ||
|
||
if (!data) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
{!data.appData && ( | ||
<Alert title={intl.formatMessage(messages.dockerVolumeMissing)}> | ||
{intl.formatMessage(messages.dockerVolumeMissingDescription, { | ||
code: function code(msg) { | ||
return <code className="bg-opacity-50">{msg}</code>; | ||
}, | ||
})} | ||
</Alert> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default AppDataWarning; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters