This commit is contained in:
2025-11-14 22:10:52 -05:00
parent c7dbc90fff
commit c0619539e6
7 changed files with 98 additions and 8 deletions

View File

@ -27,4 +27,8 @@ COMPANY_EMAIL=my@company.com
ADMIN_EMAIL=me@company.com
SECRET_MYSQL_PASSWORD_VERSION=v1
SECRET_ADMIN_PASSWORD_VERSION=v1
SECRET_ADMIN_PASSWORD_VERSION=v1
## Enable API Fix to support offline use (without an API key)
# COMPOSE_FILE="$COMPOSE_FILE:compose.api-fix.yml"
# API_FIX=apply

View File

@ -1,3 +1,4 @@
# Set any config versions here
# Docs: https://docs.coopcloud.tech/maintainers/handbook/#manage-configs
export APP_ENTRYPOINT_VERSION=v1
export API_FIX_VERSION=v1

63
api-fix.patch Normal file
View File

@ -0,0 +1,63 @@
From f0bf18d4124aa480a0650eed771c57dfd85b7f6c Mon Sep 17 00:00:00 2001
From: MIR
Date: Wed, 12 Nov 2025 17:36:37 -0500
Subject: [PATCH] Fix errors when API key unavailable
---
app/Traits/Modules.php | 2 +-
app/Traits/Plans.php | 26 ++++----------------------
2 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/app/Traits/Modules.php b/app/Traits/Modules.php
index 8382b19e6..e91b33b2d 100644
--- a/app/Traits/Modules.php
+++ b/app/Traits/Modules.php
@@ -26,7 +26,7 @@ trait Modules
$result = json_decode($response->getBody());
- return $result->success ? true : false;
+ return true;
}
// Get All Modules
diff --git a/app/Traits/Plans.php b/app/Traits/Plans.php
index 02ce4d575..b0501138d 100644
--- a/app/Traits/Plans.php
+++ b/app/Traits/Plans.php
@@ -58,29 +58,11 @@ trait Plans
public function getPlanLimitByType($type): object
{
- if (! config('app.installed') || running_in_test()) {
- $limit = new \stdClass();
-
- $limit->action_status = true;
- $limit->view_status = true;
- $limit->message = "Success";
-
- return $limit;
- }
-
- if (! $data = $this->getPlanLimits()) {
- $limit = new \stdClass();
-
- $limit->action_status = false;
- $limit->view_status = false;
- $limit->message = "Not able to create a new $type.";
-
- return $limit;
- }
-
- $limit = $data->$type;
+ $limit = new \stdClass();
- $limit->message = str_replace('{company_id}', company_id(), $limit->message);
+ $limit->action_status = true;
+ $limit->view_status = true;
+ $limit->message = "Success";
return $limit;
}
--
2.43.0

12
compose.api-fix.yml Normal file
View File

@ -0,0 +1,12 @@
---
services:
app:
configs:
- source: api_fix
target: /var/www/html/api-fix.patch
mode: 0644
configs:
api_fix:
name: ${STACK_NAME}_api_fix_${API_FIX_VERSION}
file: api-fix.patch

View File

@ -4,6 +4,7 @@ services:
image: docker.io/akaunting/akaunting:latest
networks:
- proxy
- internal
environment:
- APP_URL=https://${DOMAIN}
- DB_HOST=akaunting-db
@ -62,6 +63,8 @@ services:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
secrets:
- mysql_password
networks:
- internal
volumes:
akaunting-db:
@ -78,8 +81,10 @@ secrets:
networks:
proxy:
external: true
internal:
configs:
app_entrypoint:
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
file: docker-entrypoint.sh
file: docker-entrypoint.sh.tmpl
template_driver: golang

View File

@ -1,6 +0,0 @@
#!/bin/bash
export DB_PASSWORD=$(cat /run/secrets/mysql_password)
export ADMIN_PASSWORD=$(cat /run/secrets/admin_password)
/usr/local/bin/akaunting.sh --start

11
docker-entrypoint.sh.tmpl Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
export DB_PASSWORD=$(cat /run/secrets/mysql_password)
export ADMIN_PASSWORD=$(cat /run/secrets/admin_password)
{{ if eq (env "API_FIX") "apply" }}
cd /var/www/html
patch --batch --forward -p1 < ./api-fix.patch
{{ end }}
/usr/local/bin/akaunting.sh --start