mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-20 03:46:38 +00:00
check for user before getting orgs, create default config
This commit is contained in:
@@ -84,6 +84,25 @@ if (fs.existsSync(configFilePath1)) {
|
||||
} else if (fs.existsSync(configFilePath2)) {
|
||||
environment = loadConfig(configFilePath2);
|
||||
}
|
||||
if (!environment) {
|
||||
const exampleConfigPath = path.join("config.example.yml");
|
||||
if (fs.existsSync(exampleConfigPath)) {
|
||||
try {
|
||||
const exampleConfigContent = fs.readFileSync(exampleConfigPath, "utf8");
|
||||
fs.writeFileSync(configFilePath1, exampleConfigContent, "utf8");
|
||||
environment = loadConfig(configFilePath1);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(
|
||||
`Error creating configuration file from example: ${error.message}`,
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
throw new Error("No configuration file found and no example configuration available");
|
||||
}
|
||||
}
|
||||
|
||||
if (!environment) {
|
||||
throw new Error("No configuration file found");
|
||||
|
||||
@@ -33,12 +33,6 @@ export function buildTraefikConfig(
|
||||
|
||||
const tls = {
|
||||
certResolver: config.traefik.cert_resolver,
|
||||
// domains: [ // TODO: figure out if this is neccessary
|
||||
// {
|
||||
// main: baseDomain,
|
||||
// sans: ["*." + baseDomain],
|
||||
// },
|
||||
// ],
|
||||
};
|
||||
|
||||
const http: any = {
|
||||
@@ -59,8 +53,8 @@ export function buildTraefikConfig(
|
||||
},
|
||||
};
|
||||
for (const target of targets) {
|
||||
const routerName = `router-${target.targetId}`;
|
||||
const serviceName = `service-${target.targetId}`;
|
||||
const routerName = `${target.targetId}-router`;
|
||||
const serviceName = `${target.targetId}-service`;
|
||||
|
||||
http.routers![routerName] = {
|
||||
entryPoints: [target.ssl ? config.traefik.https_entrypoint : config.traefik.https_entrypoint],
|
||||
|
||||
Reference in New Issue
Block a user