mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
further restructuring
This commit is contained in:
parent
9b07f3eb90
commit
4386999c38
55 changed files with 224 additions and 224 deletions
35
src/utils/config/docker.js
Normal file
35
src/utils/config/docker.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import path from "path";
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import yaml from "js-yaml";
|
||||
|
||||
import checkAndCopyConfig from "utils/config/config";
|
||||
|
||||
export default function getDockerArguments(server) {
|
||||
checkAndCopyConfig("docker.yaml");
|
||||
|
||||
const configFile = path.join(process.cwd(), "config", "docker.yaml");
|
||||
const configData = readFileSync(configFile, "utf8");
|
||||
const servers = yaml.load(configData);
|
||||
|
||||
if (!server) {
|
||||
if (process.platform !== "win32" && process.platform !== "darwin") {
|
||||
return { socketPath: "/var/run/docker.sock" };
|
||||
}
|
||||
|
||||
return { host: "127.0.0.1" };
|
||||
}
|
||||
|
||||
if (servers[server]) {
|
||||
if (servers[server].socket) {
|
||||
return { socketPath: servers[server].socket };
|
||||
}
|
||||
|
||||
if (servers[server].host) {
|
||||
return { host: servers[server].host, port: servers[server].port || null };
|
||||
}
|
||||
|
||||
return servers[server];
|
||||
}
|
||||
return null;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue