mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-21 14:06:58 +01:00
Merge pull request #1232 from ajnart/fix-env-not-working
Fix env not working
This commit is contained in:
@@ -21,7 +21,9 @@
|
||||
"test": "vitest",
|
||||
"test:ui": "vitest --ui",
|
||||
"test:run": "vitest run",
|
||||
"test:coverage": "vitest run --coverage"
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"docker:build": "turbo build && docker build . -t homarr:dev",
|
||||
"docker:start": "docker run --env-file ./.env -p 7575:7575 homarr:dev "
|
||||
},
|
||||
"dependencies": {
|
||||
"@ctrl/deluge": "^4.1.0",
|
||||
|
||||
@@ -5,8 +5,12 @@ function Post(req: NextApiRequest, res: NextApiResponse) {
|
||||
const { tried, type = 'password' } = req.body;
|
||||
// If the type of password is "edit", we run this branch to check the edit password
|
||||
if (type === 'edit') {
|
||||
if (tried === process.env.EDIT_MODE_PASSWORD) {
|
||||
process.env.DISABLE_EDIT_MODE = process.env.DISABLE_EDIT_MODE === 'true' ? 'false' : 'true';
|
||||
if ((tried === process.env.EDIT_MODE_PASSWORD) !== undefined) {
|
||||
if (process.env.DISABLE_EDIT_MODE?.toLowerCase() === 'true') {
|
||||
process.env.DISABLE_EDIT_MODE = 'false';
|
||||
} else {
|
||||
process.env.DISABLE_EDIT_MODE = 'true';
|
||||
}
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
});
|
||||
|
||||
@@ -9,12 +9,7 @@ export default class DockerSingleton extends Docker {
|
||||
|
||||
public static getInstance(): DockerSingleton {
|
||||
if (!DockerSingleton.dockerInstance) {
|
||||
DockerSingleton.dockerInstance = new Docker({
|
||||
// If env variable DOCKER_HOST is not set, it will use the default socket
|
||||
...(process.env.DOCKER_HOST && { host: process.env.DOCKER_HOST }),
|
||||
// Same thing for docker port
|
||||
...(process.env.DOCKER_PORT && { port: process.env.DOCKER_PORT }),
|
||||
});
|
||||
DockerSingleton.dockerInstance = new Docker();
|
||||
}
|
||||
return DockerSingleton.dockerInstance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user