3 Commits

Author SHA1 Message Date
7945579e80 CLI 2023-11-25 00:56:18 -03:00
ab1647eed3 lighter install 2023-11-25 00:56:11 -03:00
ec7d8e69ab FIX: Remove login for API 2023-11-25 00:55:31 -03:00
62 changed files with 600 additions and 72 deletions

14
CLI.Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM php:8.1-fpm
RUN apt-get update && apt-get install -y --no-install-recommends cron && rm -r /var/lib/apt/lists/*
RUN pecl install xdebug-3.1.3 \
&& docker-php-ext-enable xdebug
COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini
WORKDIR /code
COPY ./cli/crontab /var/spool/cron/crontabs/root
CMD ["cron", "-f"]

View File

@ -1,6 +1,6 @@
FROM php:8.1-fpm FROM php:8.1-fpm
RUN apt-get update && apt-get install -y libzip-dev libicu-dev git libpng-dev unzip tzdata \ RUN apt-get update && apt-get install -y --no-install-recommends libzip-dev libicu-dev git libpng-dev unzip tzdata \
&& rm -r /var/lib/apt/lists/* && rm -r /var/lib/apt/lists/*
RUN docker-php-ext-install pdo pdo_mysql zip intl gd bcmath RUN docker-php-ext-install pdo pdo_mysql zip intl gd bcmath

View File

@ -10,4 +10,4 @@ $app->group('/api', function($app) {
include_once $file->getRealPath(); include_once $file->getRealPath();
} }
} }
}); })->add($app->getContainer()->get(Incoviba\Middleware\API::class));

View File

@ -3,4 +3,4 @@ use Incoviba\Controller\Inmobiliarias;
$app->group('/inmobiliarias', function($app) { $app->group('/inmobiliarias', function($app) {
$app->get('[/]', Inmobiliarias::class); $app->get('[/]', Inmobiliarias::class);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));

View File

@ -4,7 +4,7 @@ use Incoviba\Controller\Proyectos;
$app->group('/proyectos', function($app) { $app->group('/proyectos', function($app) {
$app->get('/unidades[/]', [Proyectos::class, 'unidades']); $app->get('/unidades[/]', [Proyectos::class, 'unidades']);
$app->get('[/]', Proyectos::class); $app->get('[/]', Proyectos::class);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
$app->group('/proyecto/{proyecto_id}', function($app) { $app->group('/proyecto/{proyecto_id}', function($app) {
$app->get('[/]', [Proyectos::class, 'show']); $app->get('[/]', [Proyectos::class, 'show']);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));

View File

@ -11,10 +11,10 @@ $app->group('/ventas', function($app) {
} }
$app->get('/add[/]', [Ventas::class, 'add']); $app->get('/add[/]', [Ventas::class, 'add']);
$app->get('[/]', Ventas::class); $app->get('[/]', Ventas::class);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
$app->group('/venta/{proyecto_nombre:[A-za-zÑñ\+\ %0-9]+}/{unidad_descripcion:[0-9]+}', function($app) { $app->group('/venta/{proyecto_nombre:[A-za-zÑñ\+\ %0-9]+}/{unidad_descripcion:[0-9]+}', function($app) {
$app->get('[/]', [Ventas::class, 'showUnidad']); $app->get('[/]', [Ventas::class, 'showUnidad']);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
$app->group('/venta/{venta_id:[0-9]+}', function($app) { $app->group('/venta/{venta_id:[0-9]+}', function($app) {
$app->group('/propietario', function($app) { $app->group('/propietario', function($app) {
$app->get('[/]', [Ventas::class, 'propietario']); $app->get('[/]', [Ventas::class, 'propietario']);
@ -29,4 +29,4 @@ $app->group('/venta/{venta_id:[0-9]+}', function($app) {
}); });
$app->get('/edit[/]', [Ventas::class, 'edit']); $app->get('/edit[/]', [Ventas::class, 'edit']);
$app->get('[/]', [Ventas::class, 'show']); $app->get('[/]', [Ventas::class, 'show']);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));

View File

@ -4,4 +4,4 @@ use Incoviba\Controller\Search;
$app->group('/search', function($app) { $app->group('/search', function($app) {
$app->get('[/{query}[/{tipo}[/]]]', Search::class); $app->get('[/{query}[/{tipo}[/]]]', Search::class);
$app->post('[/]', Search::class); $app->post('[/]', Search::class);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));

View File

@ -4,5 +4,5 @@ use Incoviba\Controller\Login;
$app->group('/login', function($app) { $app->group('/login', function($app) {
$app->post('[/]', [Login::class, 'login']); $app->post('[/]', [Login::class, 'login']);
$app->get('[/]', [Login::class, 'form']); $app->get('[/]', [Login::class, 'form']);
}); })->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
$app->get('/logout', [Login::class, 'logout']); $app->get('/logout', [Login::class, 'logout'])->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));

View File

@ -2,4 +2,4 @@
use Incoviba\Controller\Base; use Incoviba\Controller\Base;
$app->get('/construccion', [Base::class, 'construccion'])->setName('construccion'); $app->get('/construccion', [Base::class, 'construccion'])->setName('construccion');
$app->get('[/]', Base::class); $app->get('[/]', Base::class)->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));

View File

@ -28,7 +28,7 @@
return { return {
hoy: () => { hoy: () => {
const span = $('#cuotas_hoy') const span = $('#cuotas_hoy')
return fetch('{{$urls->api}}/ventas/cuotas/hoy').then(response => { return fetchAPI('{{$urls->api}}/ventas/cuotas/hoy').then(response => {
span.html('') span.html('')
if (response.ok) { if (response.ok) {
return response.json() return response.json()
@ -48,7 +48,7 @@
}, },
pendiente: () => { pendiente: () => {
const span = $('#cuotas_pendientes') const span = $('#cuotas_pendientes')
return fetch('{{$urls->api}}/ventas/cuotas/pendiente').then(response => { return fetchAPI('{{$urls->api}}/ventas/cuotas/pendiente').then(response => {
span.html('') span.html('')
if (response.ok) { if (response.ok) {
return response.json() return response.json()

View File

@ -13,7 +13,7 @@
proyectos: () => { proyectos: () => {
this.draw().loading() this.draw().loading()
const url = '{{$urls->api}}/proyectos/escriturando' const url = '{{$urls->api}}/proyectos/escriturando'
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -38,7 +38,7 @@
}, },
unidades: proyecto_id => { unidades: proyecto_id => {
const url = '{{$urls->api}}/ventas/unidades/disponibles' const url = '{{$urls->api}}/ventas/unidades/disponibles'
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => { return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -49,7 +49,7 @@
}, },
promesas: proyecto_id => { promesas: proyecto_id => {
const url = '{{$urls->api}}/ventas/estados/firmar' const url = '{{$urls->api}}/ventas/estados/firmar'
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => { return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -60,7 +60,7 @@
}, },
escrituras: proyecto_id => { escrituras: proyecto_id => {
const url = '{{$urls->api}}/ventas/escrituras/estados'; const url = '{{$urls->api}}/ventas/escrituras/estados';
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => { return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -10,7 +10,7 @@
list.append( list.append(
$('<div><div>').addClass('ui inline active loader') $('<div><div>').addClass('ui inline active loader')
) )
fetch('{{$urls->api}}/ventas/cierres/vigentes').then(response => { fetchAPI('{{$urls->api}}/ventas/cierres/vigentes').then(response => {
list.html('') list.html('')
if (response.ok) { if (response.ok) {
return response.json() return response.json()

View File

@ -10,7 +10,7 @@
list.append( list.append(
$('<div><div>').addClass('ui inline active loader') $('<div><div>').addClass('ui inline active loader')
) )
return fetch('{{$urls->api}}/ventas/cuotas/vencer').then(response => { return fetchAPI('{{$urls->api}}/ventas/cuotas/vencer').then(response => {
list.html('') list.html('')
if (response.ok) { if (response.ok) {
return response.json() return response.json()

View File

@ -2,6 +2,18 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js" integrity="sha512-5cguXwRllb+6bcc2pogwIeQmQPXEzn2ddsqAexIBhh7FO1z5Hkek1J9mrK2+rmZCTU6b6pERxI7acnp1MpAg4Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js" integrity="sha512-5cguXwRllb+6bcc2pogwIeQmQPXEzn2ddsqAexIBhh7FO1z5Hkek1J9mrK2+rmZCTU6b6pERxI7acnp1MpAg4Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="text/javascript"> <script type="text/javascript">
function fetchAPI(url, options=null) {
if (options === null) {
options = {}
}
if (!Object.hasOwn(options, 'headers')) {
options['headers'] = {}
}
if (!Object.hasOwn(options['headers'], 'Authorization')) {
options['headers']['Authorization'] = 'Bearer {{md5($API_KEY)}}'
}
return fetch(url, options)
}
const calendar_date_options = { const calendar_date_options = {
type: 'date', type: 'date',
firstDayOfWeek: 1, firstDayOfWeek: 1,

View File

@ -51,7 +51,7 @@
get() { get() {
return { return {
start: () => { start: () => {
return fetch('{{$urls->api}}/proyecto/' + this.id + '/inicio').then(response => { return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/inicio').then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -60,7 +60,7 @@
}) })
}, },
current: () => { current: () => {
return fetch('{{$urls->api}}/proyecto/' + this.id + '/estado').then(response => { return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/estado').then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -69,7 +69,7 @@
}) })
}, },
recepcion: () => { recepcion: () => {
return fetch('{{$urls->api}}/proyecto/' + this.id + '/recepcion').then(response => { return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/recepcion').then(response => {
if (response.ok) { if (response.ok) {
if (response.status === 204) { if (response.status === 204) {
return null return null

View File

@ -134,7 +134,7 @@
return { return {
superficies: () => { superficies: () => {
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/superficies/vendible' const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/superficies/vendible'
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -197,7 +197,7 @@
data: {}, data: {},
get: function() { get: function() {
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades' const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades'
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -273,7 +273,7 @@
return { return {
ventas: () => { ventas: () => {
const url = '{{$urls->api}}/ventas' const url = '{{$urls->api}}/ventas'
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'}, return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'},
body: JSON.stringify({proyecto_id: '{{$proyecto->id}}'})}).then(response => { body: JSON.stringify({proyecto_id: '{{$proyecto->id}}'})}).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
@ -294,7 +294,7 @@
}, },
stock: () => { stock: () => {
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades/disponibles' const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades/disponibles'
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -315,7 +315,7 @@
}, },
venta: venta_id => { venta: venta_id => {
const url = '{{$urls->api}}/venta/' + venta_id const url = '{{$urls->api}}/venta/' + venta_id
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -325,7 +325,7 @@
}, },
precio: unidad_id => { precio: unidad_id => {
const url = '{{$urls->api}}/ventas/precio/unidad/' + unidad_id const url = '{{$urls->api}}/ventas/precio/unidad/' + unidad_id
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
if (response.status === 204) { if (response.status === 204) {
return null return null

View File

@ -203,7 +203,7 @@
return { return {
tipos: proyecto_id => { tipos: proyecto_id => {
const url = '{{$urls->api}}/proyecto/' + proyecto_id + '/unidades/tipos' const url = '{{$urls->api}}/proyecto/' + proyecto_id + '/unidades/tipos'
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -106,7 +106,7 @@
const data = new FormData(document.getElementById('search_form')) const data = new FormData(document.getElementById('search_form'))
const uri = '{{$urls->api}}/search' const uri = '{{$urls->api}}/search'
this.data = [] this.data = []
return fetch(uri, {method: 'post', body: data}).then(response => { return fetchAPI(uri, {method: 'post', body: data}).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -155,7 +155,7 @@
}, },
unidad: id => { unidad: id => {
const url = '{{$urls->api}}/ventas/unidad/' + id const url = '{{$urls->api}}/ventas/unidad/' + id
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -163,7 +163,7 @@
}, },
venta: id => { venta: id => {
const url = '{{$urls->api}}/venta/' + id const url = '{{$urls->api}}/venta/' + id
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -269,7 +269,7 @@
return { return {
provincias: () => { provincias: () => {
const uri = '{{$urls->api}}/region/' + this.data.region + '/provincias' const uri = '{{$urls->api}}/region/' + this.data.region + '/provincias'
return fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -286,7 +286,7 @@
}, },
comunas: provincia_id => { comunas: provincia_id => {
const uri = '{{$urls->api}}/provincia/' + provincia_id + '/comunas' const uri = '{{$urls->api}}/provincia/' + provincia_id + '/comunas'
return fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -581,7 +581,7 @@
return { return {
propietario: rut => { propietario: rut => {
const uri = '{{$urls->api}}/ventas/propietario/' + rut.split('-')[0] const uri = '{{$urls->api}}/ventas/propietario/' + rut.split('-')[0]
return fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -664,7 +664,7 @@
return { return {
unidades: () => { unidades: () => {
const uri = '{{$urls->api}}/proyecto/' + this.data.id + '/unidades' const uri = '{{$urls->api}}/proyecto/' + this.data.id + '/unidades'
return fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -201,7 +201,7 @@
this.draw().loading() this.draw().loading()
return fetch('{{$urls->api}}/proyectos').then(response => { return fetchAPI('{{$urls->api}}/proyectos').then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -223,7 +223,7 @@
}) })
}, },
cierres: proyecto_id => { cierres: proyecto_id => {
return fetch('{{$urls->api}}/ventas/cierres', return fetchAPI('{{$urls->api}}/ventas/cierres',
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => { {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()

View File

@ -105,7 +105,7 @@
const cuota_id = button.data('cuota') const cuota_id = button.data('cuota')
const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date') const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date')
const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-') const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-')
fetch('{{$urls->api}}/ventas/cuota/abonar', { return fetchAPI('{{$urls->api}}/ventas/cuota/abonar', {
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha}) method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha})
}).then(response => { }).then(response => {
if (response.ok) { if (response.ok) {
@ -125,7 +125,7 @@
const cuota_id = button.data('cuota') const cuota_id = button.data('cuota')
const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date') const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date')
const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-') const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-')
fetch('{{$urls->api}}/ventas/cuota/devolver', { return fetchAPI('{{$urls->api}}/ventas/cuota/devolver', {
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha}) method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha})
}).then(response => { }).then(response => {
if (response.ok) { if (response.ok) {

View File

@ -105,7 +105,7 @@
const cuota_id = button.data('cuota') const cuota_id = button.data('cuota')
const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date') const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date')
const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-') const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-')
fetch('{{$urls->api}}/ventas/cuota/depositar', { return fetchAPI('{{$urls->api}}/ventas/cuota/depositar', {
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha}) method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha})
}).then(response => { }).then(response => {
if (response.ok) { if (response.ok) {

View File

@ -68,7 +68,7 @@
return return
} }
const uri = '{{$urls->api}}/venta/{{$venta->id}}' const uri = '{{$urls->api}}/venta/{{$venta->id}}'
return fetch(uri, return fetchAPI(uri,
{method: 'put', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)} {method: 'put', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
).then(response => { ).then(response => {
if (response.ok) { if (response.ok) {

View File

@ -53,7 +53,7 @@
method: 'post', method: 'post',
body: data body: data
} }
return this.sent.uf[date.toISOString()] = fetch(url, options).then(response => { return this.sent.uf[date.toISOString()] = fetchAPI(url, options).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -75,7 +75,7 @@
method: 'post', method: 'post',
body: data body: data
} }
return this.sent.ipc[dateKey] = fetch(url, options).then(response => { return this.sent.ipc[dateKey] = fetchAPI(url, options).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -127,7 +127,7 @@
return { return {
unidades: () => { unidades: () => {
const url = '{{$urls->api}}/venta/' + this.id + '/unidades' const url = '{{$urls->api}}/venta/' + this.id + '/unidades'
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -233,7 +233,7 @@
return { return {
ventas: () => { ventas: () => {
const url = '{{$urls->api}}/ventas/facturacion/proyecto/' + this.selected const url = '{{$urls->api}}/ventas/facturacion/proyecto/' + this.selected
return fetch(url).then(response => { return fetchAPI(url).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -103,7 +103,7 @@
ventas: proyecto_id => { ventas: proyecto_id => {
this.data.venta_ids = [] this.data.venta_ids = []
this.data.ventas = [] this.data.ventas = []
return fetch('{{$urls->api}}/ventas', return fetchAPI('{{$urls->api}}/ventas',
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})} {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}
).then(response => { ).then(response => {
this.loading.precios = false this.loading.precios = false
@ -130,7 +130,7 @@
}) })
}, },
venta: venta_id => { venta: venta_id => {
return fetch('{{$urls->api}}/venta/' + venta_id).then(response => { return fetchAPI('{{$urls->api}}/venta/' + venta_id).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -34,7 +34,7 @@
return { return {
pagos: () => { pagos: () => {
const uri = '{{$urls->api}}/ventas/pagos/pendientes' const uri = '{{$urls->api}}/ventas/pagos/pendientes'
fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -138,7 +138,7 @@
return { return {
pendientes: () => { pendientes: () => {
const uri = '{{$urls->api}}/ventas/pagos/abonar' const uri = '{{$urls->api}}/ventas/pagos/abonar'
fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -218,7 +218,7 @@
return { return {
devueltos: () => { devueltos: () => {
const uri = '{{$urls->api}}/ventas/pagos/rebotes' const uri = '{{$urls->api}}/ventas/pagos/rebotes'
fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -339,7 +339,7 @@
$(this.ids.buttons.add).hide() $(this.ids.buttons.add).hide()
return fetch('{{$urls->api}}/proyectos').then(response => { return fetchAPI('{{$urls->api}}/proyectos').then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -357,7 +357,7 @@
}, },
precios: proyecto_id => { precios: proyecto_id => {
this.data.precios = [] this.data.precios = []
return fetch('{{$urls->api}}/ventas/precios', return fetchAPI('{{$urls->api}}/ventas/precios',
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})} {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}
).then(response => { ).then(response => {
$('.item.proyecto').css('cursor', 'default') $('.item.proyecto').css('cursor', 'default')
@ -639,7 +639,7 @@
fecha: $(this.ids.fields.calendar).calendar('get date'), fecha: $(this.ids.fields.calendar).calendar('get date'),
valor: $(this.ids.fields.valor).val() valor: $(this.ids.fields.valor).val()
} }
return fetch('{{$urls->api}}/precios/update', return fetchAPI('{{$urls->api}}/precios/update',
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)} {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
).then(response => { ).then(response => {
if (response.ok) { if (response.ok) {

View File

@ -79,7 +79,7 @@ Editar Propietario
const original_id = $("[name='comuna']").val() const original_id = $("[name='comuna']").val()
const uri = '{{$urls->api}}/direcciones/comunas/find' const uri = '{{$urls->api}}/direcciones/comunas/find'
const data = {direccion} const data = {direccion}
return fetch(uri, return fetchAPI(uri,
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)} {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
).then(response => { ).then(response => {
if (response.ok) { if (response.ok) {
@ -101,7 +101,7 @@ Editar Propietario
const parent = $('#comunas') const parent = $('#comunas')
parent.hide() parent.hide()
const uri = '{{$urls->api}}/direcciones/region/' + region_id + '/comunas' const uri = '{{$urls->api}}/direcciones/region/' + region_id + '/comunas'
return fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }
@ -195,7 +195,7 @@ Editar Propietario
redirect() redirect()
return return
} }
return fetch(uri, return fetchAPI(uri,
{method: 'put', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)} {method: 'put', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
).then(response => { ).then(response => {
if (response.ok) { if (response.ok) {

View File

@ -48,7 +48,7 @@
return { return {
comentarios: () => { comentarios: () => {
const uri = '{{$urls->api}}/venta/{{$venta->id}}/comentarios' const uri = '{{$urls->api}}/venta/{{$venta->id}}/comentarios'
return fetch(uri).then(response => { return fetchAPI(uri).then(response => {
if (response.ok) { if (response.ok) {
return response.json() return response.json()
} }

View File

@ -176,7 +176,7 @@
modal.find('.ui.button').click(event => { modal.find('.ui.button').click(event => {
modal.modal('hide') modal.modal('hide')
const date = modal.find('#fecha').val() const date = modal.find('#fecha').val()
return fetch(uri, return fetchAPI(uri,
{method: 'put', body: JSON.stringify({fecha: date}), headers: {'Content-Type': 'application/json'}} {method: 'put', body: JSON.stringify({fecha: date}), headers: {'Content-Type': 'application/json'}}
).then(response => { ).then(response => {
anchor.css('pointer-events', '') anchor.css('pointer-events', '')
@ -206,7 +206,7 @@
modal.modal('show') modal.modal('show')
modal.find('.ui.button').click(event => { modal.find('.ui.button').click(event => {
const date = modal.find('#fecha').val() const date = modal.find('#fecha').val()
return fetch(uri, return fetchAPI(uri,
{method: 'put', body: JSON.stringify({fecha: date}), headers: {'Content-Type': 'application/json'}} {method: 'put', body: JSON.stringify({fecha: date}), headers: {'Content-Type': 'application/json'}}
).then(response => { ).then(response => {
anchor.css('pointer-events', '') anchor.css('pointer-events', '')

View File

@ -1,2 +1,2 @@
<?php <?php
$app->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class)); //$app->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));

View File

@ -2,9 +2,6 @@
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
return [ return [
Psr\Http\Message\ResponseFactoryInterface::class => function(ContainerInterface $container) {
return $container->get(Nyholm\Psr7\Factory\Psr17Factory::class);
},
Incoviba\Middleware\Authentication::class => function(ContainerInterface $container) { Incoviba\Middleware\Authentication::class => function(ContainerInterface $container) {
return new Incoviba\Middleware\Authentication( return new Incoviba\Middleware\Authentication(
$container->get(Psr\Http\Message\ResponseFactoryInterface::class), $container->get(Psr\Http\Message\ResponseFactoryInterface::class),
@ -13,5 +10,11 @@ return [
$container->get(Incoviba\Common\Alias\View::class), $container->get(Incoviba\Common\Alias\View::class),
implode('/', [$container->get('APP_URL'), 'login']) implode('/', [$container->get('APP_URL'), 'login'])
); );
},
Incoviba\Middleware\API::class => function(ContainerInterface $container) {
return new Incoviba\Middleware\API(
$container->get(Psr\Http\Message\ResponseFactoryInterface::class),
$container->get('API_KEY')
);
} }
]; ];

View File

@ -9,6 +9,7 @@ return [
'money_url' => '', 'money_url' => '',
'login' => $container->get(Incoviba\Service\Login::class), 'login' => $container->get(Incoviba\Service\Login::class),
'format' => $container->get(Incoviba\Service\Format::class), 'format' => $container->get(Incoviba\Service\Format::class),
'API_KEY' => $container->get('API_KEY'),
]; ];
if ($global_variables['login']->isIn()) { if ($global_variables['login']->isIn()) {
$global_variables['user'] = $global_variables['login']->getUser(); $global_variables['user'] = $global_variables['login']->getUser();

View File

@ -47,20 +47,20 @@ class Money
protected function getValue(Service\Redis $redisService, string $redisKey, Service\Money $moneyService, protected function getValue(Service\Redis $redisService, string $redisKey, Service\Money $moneyService,
DateTimeInterface $date, string $provider): float DateTimeInterface $date, string $provider): float
{ {
if (isset($this->data[$date->format('Y-m-d')])) { if (isset($this->data[$provider][$date->format('Y-m-d')])) {
return $this->data[$date->format('Y-m-d')]; return $this->data[$provider][$date->format('Y-m-d')];
} }
try { try {
$this->data = (array) $this->fetchRedis($redisService, $redisKey); $this->data[$provider] = (array) $this->fetchRedis($redisService, $redisKey);
if (!isset($this->data[$date->format('Y-m-d')])) { if (!isset($this->data[$provider][$date->format('Y-m-d')])) {
throw new EmptyRedis($redisKey); throw new EmptyRedis($redisKey);
} }
} catch (EmptyRedis) { } catch (EmptyRedis) {
$result = $moneyService->get($provider, $date); $result = $moneyService->get($provider, $date);
$this->data[$date->format('Y-m-d')] = $result; $this->data[$provider][$date->format('Y-m-d')] = $result;
$this->saveRedis($redisService, $redisKey, $this->data, $this->time); $this->saveRedis($redisService, $redisKey, $this->data[$provider], $this->time);
} }
return $this->data[$date->format('Y-m-d')]; return $this->data[$provider][$date->format('Y-m-d')];
} }
/*public function uf(ServerRequestInterface $request, ResponseInterface $response, Service\Redis $redisService, Service\Money $moneyService): ResponseInterface /*public function uf(ServerRequestInterface $request, ResponseInterface $response, Service\Redis $redisService, Service\Money $moneyService): ResponseInterface
{ {

View File

@ -0,0 +1,13 @@
<?php
namespace Incoviba\Exception;
use Throwable;
use Exception;
class MissingAuthorizationHeader extends Exception
{
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Incoviba\Middleware;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Incoviba\Exception\MissingAuthorizationHeader;
class API
{
public function __construct(protected ResponseFactoryInterface $responseFactory, protected string $key) {}
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
try {
$key = $this->getKey($request);
} catch (MissingAuthorizationHeader $exception) {
return $this->responseFactory->createResponse(401);
}
if ($this->validate($key)) {
return $handler->handle($request);
}
return $this->responseFactory->createResponse(403);
}
protected function getKey(ServerRequestInterface $request): string
{
$auth_headers = $request->getHeader('Authorization');
foreach ($auth_headers as $header) {
if (str_contains($header, 'Bearer')) {
return substr($header, strlen('Bearer '));
}
}
throw new MissingAuthorizationHeader();
}
protected function validate($incoming_key): bool
{
return $incoming_key === md5($this->key);
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Incoviba\Common\Alias;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application as Base;
class Application extends Base
{
public function __construct(protected ContainerInterface $container, string $name = 'UNKNOWN', string $version = 'UNKNOWN')
{
if ($this->container->has('APP_NAME')) {
$name = $this->container->get('APP_NAME');
}
parent::__construct($name, $version);
}
public function getContainer(): ContainerInterface
{
return $this->container;
}
}

29
cli/composer.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "incoviba/cli",
"type": "project",
"require": {
"symfony/console": "^6.3",
"php-di/php-di": "^7.0",
"guzzlehttp/guzzle": "^7.8",
"monolog/monolog": "^3.5"
},
"require-dev": {
"phpunit/phpunit": "^10.4",
"kint-php/kint": "^5.1"
},
"authors": [
{
"name": "Aldarien",
"email": "aldarien85@gmail.com"
}
],
"autoload": {
"psr-4": {
"Incoviba\\Common\\": "common/",
"Incoviba\\": "src/"
}
},
"config": {
"sort-packages": true
}
}

8
cli/crontab Normal file
View File

@ -0,0 +1,8 @@
0 2 * * * php /code/bin/index.php ventas:cuotas:hoy
0 2 * * * php /code/bin/index.php ventas:cuotas:pendientes
0 2 * * * php /code/bin/index.php ventas:cuotas:vencer
0 2 * * * php /code/bin/index.php ventas:cierres:vigentes
0 2 * * * php /code/bin/index.php proyectos:activos
0 2 * * * php /code/bin/index.php comunas
0 2 * * * php /code/bin/index.php money:uf
0 2 1 * * php /code/bin/index.php money:ipc

View File

@ -0,0 +1,2 @@
<?php
$app->add($app->getContainer()->get(Incoviba\Command\Comunas::class));

View File

@ -0,0 +1,3 @@
<?php
$app->add($app->getContainer()->get(Incoviba\Command\Money\UF::class));
$app->add($app->getContainer()->get(Incoviba\Command\Money\IPC::class));

View File

@ -0,0 +1,9 @@
<?php
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'proyectos']);
$files = new FilesystemIterator($folder);
foreach ($files as $file) {
if ($file->isDir()) {
continue;
}
include_once $file->getRealPath();
}

View File

@ -0,0 +1,2 @@
<?php
$app->add($app->getContainer()->get(Incoviba\Command\Proyectos\Activos::class));

View File

@ -0,0 +1,9 @@
<?php
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'ventas']);
$files = new FilesystemIterator($folder);
foreach ($files as $file) {
if ($file->isDir()) {
continue;
}
include_once $file->getRealPath();
}

View File

@ -0,0 +1,2 @@
<?php
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cierres\Vigentes::class));

View File

@ -0,0 +1,4 @@
<?php
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cuotas\Hoy::class));
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cuotas\Pendientes::class));
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cuotas\PorVencer::class));

42
cli/setup/app.php Normal file
View File

@ -0,0 +1,42 @@
<?php
use DI\ContainerBuilder;
use Incoviba\Common\Alias\Application;
include_once 'composer.php';
function buildApp(): Application
{
$builder = new ContainerBuilder();
$folders = [
'settings',
'setups'
];
foreach ($folders as $folder_name) {
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, $folder_name]);
if (!file_exists($folder)) {
continue;
}
$files = new FilesystemIterator($folder);
foreach ($files as $file) {
if ($file->isDir()) {
continue;
}
$builder->addDefinitions($file->getRealPath());
}
}
$app = new Application($builder->build());
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'middlewares']);
if (file_exists($folder)) {
$files = new FilesystemIterator($folder);
foreach ($files as $file) {
if ($file->isDir()) {
continue;
}
include_once $file->getRealPath();
}
}
return $app;
}
return buildApp();

6
cli/setup/composer.php Normal file
View File

@ -0,0 +1,6 @@
<?php
require_once implode(DIRECTORY_SEPARATOR, [
dirname(__FILE__, 2),
'vendor',
'autoload.php'
]);

View File

@ -0,0 +1,11 @@
<?php
function loadCommands(&$app): void {
$files = new FilesystemIterator($app->getContainer()->get('folders')->commands);
foreach ($files as $file) {
if ($file->isDir()) {
continue;
}
include_once $file->getRealPath();
}
}
loadCommands($app);

View File

@ -0,0 +1,2 @@
<?php
return $_ENV;

View File

@ -0,0 +1,15 @@
<?php
return [
'folders' => function() {
$arr = ['base' => dirname(__FILE__, 3)];
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
$arr['base'],
'resources'
]);
$arr['commands'] = implode(DIRECTORY_SEPARATOR, [
$arr['resources'],
'commands'
]);
return (object) $arr;
}
];

View File

@ -0,0 +1,15 @@
<?php
use Psr\Container\ContainerInterface;
return [
Psr\Http\Client\ClientInterface::class => function(ContainerInterface $container) {
return new GuzzleHttp\Client([
'base_uri' => $container->get('API_URL'),
'headers' => [
'Authorization' => [
'Bearer ' . md5($container->get('API_KEY'))
]
]
]);
}
];

32
cli/setup/setups/logs.php Normal file
View File

@ -0,0 +1,32 @@
<?php
use Psr\Container\ContainerInterface;
return [
Psr\Log\LoggerInterface::class => function(ContainerInterface $container) {
return new Monolog\Logger('incoviba', [
new Monolog\Handler\FilterHandler(
(new Monolog\Handler\RotatingFileHandler('/logs/debug.log'))
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)),
Monolog\Level::Debug,
Monolog\Level::Notice
),
new Monolog\Handler\FilterHandler(
(new Monolog\Handler\RotatingFileHandler('/logs/error.log'))
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)),
Monolog\Level::Warning,
Monolog\Level::Error
),
new Monolog\Handler\FilterHandler(
(new Monolog\Handler\RotatingFileHandler('/logs/critical.log'))
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)),
Monolog\Level::Critical
)
], [
$container->get(Monolog\Processor\PsrLogMessageProcessor::class),
$container->get(Monolog\Processor\WebProcessor::class),
$container->get(Monolog\Processor\IntrospectionProcessor::class),
$container->get(Monolog\Processor\MemoryUsageProcessor::class),
$container->get(Monolog\Processor\MemoryPeakUsageProcessor::class)
]);
}
];

View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Command;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'comunas'
)]
class Comunas extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$uri = '/api/direcciones/region/13/comunas';
$output->writeln("GET {$uri}");
$response = $this->client->get($uri);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Incoviba\Command\Money;
use DateTimeImmutable;
use DateInterval;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'money:ipc'
)]
class IPC extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$lastMonth = (new DateTimeImmutable())->sub(new DateInterval('P1M'));
$uri = '/api/money';
$data = [
'provider' => 'ipc',
'fecha' => $lastMonth->format('Y-m-1')
];
$output->writeln("POST {$uri}");
$response = $this->client->post($uri, [
'body' => http_build_query($data),
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
]);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace Incoviba\Command\Money;
use DateTimeImmutable;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'money:uf'
)]
class UF extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$now = new DateTimeImmutable();
$uri = '/api/money';
$data = [
'provider' => 'uf',
'fecha' => $now->format('Y-m-d')
];
$output->writeln("POST {$uri}");
$response = $this->client->post($uri, [
'body' => http_build_query($data),
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
]);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Command\Proyectos;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'proyectos:activos'
)]
class Activos extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$uri = '/api/proyectos';
$output->writeln("GET {$uri}");
$response = $this->client->get($uri);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Command\Ventas\Cierres;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'ventas:cierres:vigentes'
)]
class Vigentes extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$uri = '/api/ventas/cierres/vigentes';
$output->writeln("GET {$uri}");
$response = $this->client->get($uri);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Command\Ventas\Cuotas;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'ventas:cuotas:hoy'
)]
class Hoy extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$uri = '/api/ventas/cuotas/hoy';
$output->writeln("GET {$uri}");
$response = $this->client->get($uri);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Command\Ventas\Cuotas;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'ventas:cuotas:pendientes'
)]
class Pendientes extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$uri = '/api/ventas/cuotas/pendientes';
$output->writeln("GET {$uri}");
$response = $this->client->get($uri);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Command\Ventas\Cuotas;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console;
#[Console\Attribute\AsCommand(
name: 'ventas:cuotas:vencer'
)]
class PorVencer extends Console\Command\Command
{
public function __construct(protected ClientInterface $client, string $name = null)
{
parent::__construct($name);
}
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$uri = '/api/ventas/cuotas/vencer';
$output->writeln("GET {$uri}");
$response = $this->client->get($uri);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}

View File

@ -26,6 +26,7 @@ services:
env_file: env_file:
- ${APP_PATH:-.}/.env - ${APP_PATH:-.}/.env
- ${APP_PATH:-.}/.db.env - ${APP_PATH:-.}/.db.env
- ./.key.env
#- ${APP_PATH:-.}/.remote.env #- ${APP_PATH:-.}/.remote.env
volumes: volumes:
- ${APP_PATH:-.}/:/code - ${APP_PATH:-.}/:/code
@ -83,6 +84,20 @@ services:
- "./logs:/logs" - "./logs:/logs"
ports: ports:
- "8084:80" - "8084:80"
cli:
profiles:
- cli
build:
context: .
dockerfile: CLI.Dockerfile
container_name: incoviba_cli
<<: *restart
env_file:
- ${CLI_PATH:-.}/.env
- ./.key.env
volumes:
- ${CLI_PATH:-.}:/code
- ./logs/cli:/logs
volumes: volumes:
dbdata: {} dbdata: {}