Features:
- Rust support 🦀 (Thanks to @pepoviola)
- Add a default rewrite rule to PHP apps (to index.php)
- Able to control upgrades in a straightforward way
Fixes:
- Improved upgrade scripts
- Simplified prechecks before deployment
- Fixed path deployments
- Fixed already defined apps redirections
- Better error handling - still needs a lot of improvement here!
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
const { docker } = require('../../libs/docker')
|
|
|
|
module.exports = async function (fastify) {
|
|
fastify.post('/', async (request, reply) => {
|
|
const { name, organization, branch } = request.body
|
|
const services = await docker.engine.listServices()
|
|
const applications = services.filter(r => r.Spec.Labels.managedBy === 'coolify' && r.Spec.Labels.type === 'application')
|
|
|
|
const found = applications.find(r => {
|
|
const configuration = r.Spec.Labels.configuration ? JSON.parse(r.Spec.Labels.configuration) : null
|
|
if (branch) {
|
|
if (configuration.repository.name === name && configuration.repository.organization === organization && configuration.repository.branch === branch) {
|
|
return r
|
|
}
|
|
} else {
|
|
if (configuration.repository.name === name && configuration.repository.organization === organization) {
|
|
return r
|
|
}
|
|
}
|
|
return null
|
|
})
|
|
if (found) {
|
|
return JSON.parse(found.Spec.Labels.configuration)
|
|
} else {
|
|
reply.code(500).send({ message: 'No configuration found.' })
|
|
}
|
|
})
|
|
}
|