This commit is contained in:
Andras Bacsai 2022-10-25 22:43:31 +02:00
parent b0fcd23ca6
commit 111bd29cc8
3 changed files with 12 additions and 13 deletions

View File

@ -1892,8 +1892,8 @@
- '9001'
proxy:
- port: '9000'
- port: '9001'
domain: $$coolify_fqdn_minio_console
- port: '9001'
variables:
- id: $$coolify_fqdn_minio_console
name: MINIO_SERVER_URL

View File

@ -41,10 +41,14 @@ export async function cleanupManually(request: FastifyRequest) {
export async function refreshTemplates() {
try {
const { default: got } = await import('got')
let templates = {}
try {
const response = await got.get('https://get.coollabs.io/coolify/service-templates.yaml').text()
templates = yaml.load(response)
if (isDev) {
const response = await fs.readFile('./devTemplates.yaml', 'utf8')
await fs.writeFile('./template.json', JSON.stringify(yaml.load(response), null, 2))
} else {
const response = await got.get('https://get.coollabs.io/coolify/service-templates.yaml').text()
await fs.writeFile('/app/template.json', JSON.stringify(yaml.load(response), null, 2))
}
} catch (error) {
throw {
status: 500,
@ -52,11 +56,6 @@ export async function refreshTemplates() {
};
}
if (isDev) {
await fs.writeFile('./template.json', JSON.stringify(templates, null, 2))
} else {
await fs.writeFile('/app/template.json', JSON.stringify(templates, null, 2))
}
return {};
} catch ({ status, message }) {
return errorHandler({ status, message });

View File

@ -20,7 +20,7 @@ function generateLoadBalancerService(id, port) {
function generateHttpRouter(id, nakedDomain, pathPrefix) {
return {
entrypoints: ['web'],
rule: `(Host(\`${nakedDomain}\`) || Host(\`www.${nakedDomain}\`)) && PathPrefix(\`${pathPrefix}\`)`,
rule: `(Host(\`${nakedDomain}\`) || Host(\`www.${nakedDomain}\`))${pathPrefix ? `&& PathPrefix(\`${pathPrefix}\`)` : ''}`,
service: `${id}`,
middlewares: []
}
@ -29,7 +29,7 @@ function generateProtocolRedirectRouter(id, nakedDomain, pathPrefix, fromTo) {
if (fromTo === 'https-to-http') {
return {
entrypoints: ['websecure'],
rule: `(Host(\`${nakedDomain}\`) || Host(\`www.${nakedDomain}\`)) && PathPrefix(\`${pathPrefix}\`)`,
rule: `(Host(\`${nakedDomain}\`) || Host(\`www.${nakedDomain}\`))${pathPrefix ? `&& PathPrefix(\`${pathPrefix}\`)` : ''}`,
service: `${id}`,
tls: {
domains: {
@ -41,7 +41,7 @@ function generateProtocolRedirectRouter(id, nakedDomain, pathPrefix, fromTo) {
} else if (fromTo === 'http-to-https') {
return {
entrypoints: ['web'],
rule: `(Host(\`${nakedDomain}\`) || Host(\`www.${nakedDomain}\`)) && PathPrefix(\`${pathPrefix}\`)`,
rule: `(Host(\`${nakedDomain}\`) || Host(\`www.${nakedDomain}\`))${pathPrefix ? `&& PathPrefix(\`${pathPrefix}\`)` : ''}`,
service: `${id}`,
middlewares: ['redirect-to-https']
};
@ -409,7 +409,7 @@ export async function traefikConfiguration(request, reply) {
}
}
for (const service of data.services) {
let { id, fqdn, dualCerts, configuration: { port, pathPrefix = '/', domain: customDomain }, isCustomSSL = false } = service
let { id, fqdn, dualCerts, configuration: { port, pathPrefix, domain: customDomain }, isCustomSSL = false } = service
if (customDomain) {
fqdn = customDomain
}