Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [mealie] Environment variables not being imported from the config.yaml #1635

Closed
jo-anb opened this issue Nov 14, 2024 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@jo-anb
Copy link

jo-anb commented Nov 14, 2024

Description

I've set openapi variables in the config file.
However the addon does not seem to pick them up.
I 've restarted the addon multiple times

this is the content of /addon_configs/db21ed7f_mealie/config.yaml:

TZ: Europe/Paris
OPENAI_API_KEY: "******************************************************************"
OPENAI_SEND_DATABASE_DATA: False
OPENAI_WORKERS: 1

Reproduction steps

Go to /addon_configs/db21ed7f_mealie
Open the config.yaml file.

Add the variables and save the file

Restart the add-on

Addon Logs

-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
ALLOW_SIGNUP='false'
BASE_URL='http://homeassistant.local'
DATA_DIR='/config'
PGID='1000'
PUID='1000'
certfile='fullchain.pem'
keyfile='privkey.pem'
ssl='false'
Timezone set from Etc/UTC to Europe/Zurich
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory
Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f_mealie/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables
... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /addon_configs/db21ed7f_mealie/mealie.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/31-nginx.sh: executing
[21:46:07] INFO: Adapting for ingress
[21:46:08] INFO: Exporting variables
ALLOW_SIGNUP=false
BASE_URL=http://homeassistant.local
DATA_DIR=/config
PGID=1000
PUID=1000
certfile=fullchain.pem
keyfile=privkey.pem
ssl=false
[21:46:14] INFO: config.yaml found in /config/config.yaml, exporting variables
Permissions adapted
[21:46:15] INFO: Starting nginx
[21:46:15] INFO: Starting app
INFO     2024-11-14T21:47:24 - Started server process [8]
INFO     2024-11-14T21:47:24 - Waiting for application startup.
INFO     2024-11-14T21:47:24 - start: database initialization
INFO     2024-11-14T21:47:24 - Database connection established.
INFO     2024-11-14T21:47:24 - Context impl SQLiteImpl.
INFO     2024-11-14T21:47:24 - Will assume non-transactional DDL.
INFO     2024-11-14T21:47:25 - Checking for migration data fixes
INFO     2024-11-14T21:47:27 - end: database initialization
INFO     2024-11-14T21:47:27 - -----SYSTEM STARTUP-----
INFO     2024-11-14T21:47:27 - ------APP SETTINGS------
INFO     2024-11-14T21:47:27 - {
    "TESTING": false,
    "PRODUCTION": true,
    "LOG_CONFIG_OVERRIDE": null,
    "LOG_LEVEL": "info",
    "theme": {
        "light_primary": "#E58325",
        "light_accent": "#007A99",
        "light_secondary": "#973542",
        "light_success": "#43A047",
        "light_info": "#1976D2",
        "light_warning": "#FF6D00",
        "light_error": "#EF5350",
        "dark_primary": "#E58325",
        "dark_accent": "#007A99",
        "dark_secondary": "#973542",
        "dark_success": "#43A047",
        "dark_info": "#1976D2",
        "dark_warning": "#FF6D00",
        "dark_error": "#EF5350"
    },
    "BASE_URL": "http://homeassistant.local",
    "STATIC_FILES": "/spa/static",
    "IS_DEMO": false,
    "HOST_IP": "*",
    "API_HOST": "0.0.0.0",
    "API_PORT": 9000,
    "API_DOCS": true,
    "TOKEN_TIME": 48,
    "GIT_COMMIT_HASH": "3e69ea94d5699da7ea1abe2fb77109bd38c8ded0",
    "ALLOW_SIGNUP": false,
    "DAILY_SCHEDULE_TIME": "23:45",
    "SECURITY_MAX_LOGIN_ATTEMPTS": 5,
    "SECURITY_USER_LOCKOUT_TIME": 24,
    "DB_ENGINE": "sqlite",
    "DEFAULT_GROUP": "Home",
    "DEFAULT_HOUSEHOLD": "Family",
    "SMTP_HOST": null,
    "SMTP_PORT": "587",
    "SMTP_FROM_NAME": "Mealie",
    "SMTP_FROM_EMAIL": null,
    "SMTP_AUTH_STRATEGY": "TLS",
    "LDAP_AUTH_ENABLED": false,
    "LDAP_SERVER_URL": null,
    "LDAP_TLS_INSECURE": false,
    "LDAP_TLS_CACERTFILE": null,
    "LDAP_ENABLE_STARTTLS": false,
    "LDAP_BASE_DN": null,
    "LDAP_QUERY_BIND": null,
    "LDAP_USER_FILTER": null,
    "LDAP_ADMIN_FILTER": null,
    "LDAP_ID_ATTRIBUTE": "uid",
    "LDAP_MAIL_ATTRIBUTE": "mail",
    "LDAP_NAME_ATTRIBUTE": "name",
    "OIDC_AUTH_ENABLED": false,
    "OIDC_CLIENT_ID": null,
    "OIDC_CONFIGURATION_URL": null,
    "OIDC_SIGNUP_ENABLED": true,
    "OIDC_USER_GROUP": null,
    "OIDC_ADMIN_GROUP": null,
    "OIDC_AUTO_REDIRECT": false,
    "OIDC_PROVIDER_NAME": "OAuth",
    "OIDC_REMEMBER_ME": false,
    "OIDC_USER_CLAIM": "email",
    "OIDC_GROUPS_CLAIM": "groups",
    "OIDC_TLS_CACERTFILE": null,
    "OPENAI_BASE_URL": null,
    "OPENAI_MODEL": "gpt-4o",
    "OPENAI_CUSTOM_HEADERS": {},
    "OPENAI_CUSTOM_PARAMS": {},
    "OPENAI_ENABLE_IMAGE_SERVICES": true,
    "OPENAI_WORKERS": 2,
    "OPENAI_SEND_DATABASE_DATA": true,
    "OPENAI_REQUEST_TIMEOUT": 60,
    "WORKER_PER_CORE": 1,
    "UVICORN_WORKERS": 1
}
INFO     2024-11-14T21:47:27 - Daily tasks scheduled for 2024-11-14 22:45:00+00:00
INFO     2024-11-14T21:47:27 - Application startup complete.

Architecture

amd64

OS

HAos

@jo-anb jo-anb added the bug Something isn't working label Nov 14, 2024
@alexbelgium
Copy link
Owner

Hi, strange that the others variables are picked up and not that one. Please try with a fake simpler key to check if the issue is with Mealie not picking up on it (so perhaps an upstream issue), or if it's because their is non standard characters that are not supported by HA options thanks

@jo-anb
Copy link
Author

jo-anb commented Nov 17, 2024

I changed te config to just send the variable

LOG_LEVEL: "debug"

However, it still does not pick it up.

INFO     2024-11-17T12:01:24 - -----SYSTEM SHUTDOWN----- 
INFO     2024-11-17T12:01:24 - Application shutdown complete.
INFO     2024-11-17T12:01:24 - Finished server process [7]
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Mealie
 Mealie is a self hosted recipe manager and meal planner built in Vue
-----------------------------------------------------------
 Add-on version: v2.1.0-2
 There is an update available for this add-on!
 Latest add-on version: v2.2.0
 Please consider upgrading as soon as possible.
 System: Home Assistant OS 13.2  (aarch64 / green)
 Home Assistant Core: 2024.11.1
 Home Assistant Supervisor: 2024.11.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID : 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
ALLOW_SIGNUP='false'
BASE_URL='http://homeassistant.local'
DATA_DIR='/config'
PGID='1000'
PUID='1000'
certfile='fullchain.pem'
keyfile='privkey.pem'
ssl='false'
Timezone set from Etc/UTC to Europe/Zurich
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory
Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f_mealie/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables
... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /addon_configs/db21ed7f_mealie/mealie.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/31-nginx.sh: executing
[12:01:46] INFO: Adapting for ingress
[12:01:47] INFO: Exporting variables
ALLOW_SIGNUP=false
BASE_URL=http://homeassistant.local
DATA_DIR=/config
PGID=1000
PUID=1000
certfile=fullchain.pem
keyfile=privkey.pem
ssl=false
[12:01:53] INFO: config.yaml found in /config/config.yaml, exporting variables
Permissions adapted
[12:01:53] INFO: Starting nginx
[12:01:53] INFO: Starting app
INFO     2024-11-17T12:04:35 - Started server process [7]
INFO     2024-11-17T12:04:35 - Waiting for application startup.
INFO     2024-11-17T12:04:35 - start: database initialization
INFO     2024-11-17T12:04:35 - Database connection established.
INFO     2024-11-17T12:04:35 - Context impl SQLiteImpl.
INFO     2024-11-17T12:04:35 - Will assume non-transactional DDL.
INFO     2024-11-17T12:04:35 - Checking for migration data fixes
INFO     2024-11-17T12:04:37 - end: database initialization
INFO     2024-11-17T12:04:37 - -----SYSTEM STARTUP-----
INFO     2024-11-17T12:04:37 - ------APP SETTINGS------
INFO     2024-11-17T12:04:37 - {
    "TESTING": false,
    "PRODUCTION": true,
    "LOG_CONFIG_OVERRIDE": null,
    "LOG_LEVEL": "info",
    "theme": {
        "light_primary": "#E58325",
        "light_accent": "#007A99",
        "light_secondary": "#973542",
        "light_success": "#43A047",
        "light_info": "#1976D2",
        "light_warning": "#FF6D00",
        "light_error": "#EF5350",
        "dark_primary": "#E58325",
        "dark_accent": "#007A99",
        "dark_secondary": "#973542",
        "dark_success": "#43A047",
        "dark_info": "#1976D2",
        "dark_warning": "#FF6D00",
        "dark_error": "#EF5350"
    },
    "BASE_URL": "http://homeassistant.local",
    "STATIC_FILES": "/spa/static",
    "IS_DEMO": false,
    "HOST_IP": "*",
    "API_HOST": "0.0.0.0",
    "API_PORT": 9000,
    "API_DOCS": true,
    "TOKEN_TIME": 48,
    "GIT_COMMIT_HASH": "3e69ea94d5699da7ea1abe2fb77109bd38c8ded0",
    "ALLOW_SIGNUP": false,
    "DAILY_SCHEDULE_TIME": "23:45",
    "SECURITY_MAX_LOGIN_ATTEMPTS": 5,
    "SECURITY_USER_LOCKOUT_TIME": 24,
    "DB_ENGINE": "sqlite",
    "DEFAULT_GROUP": "Home",
    "DEFAULT_HOUSEHOLD": "Family",
    "SMTP_HOST": null,
    "SMTP_PORT": "587",
    "SMTP_FROM_NAME": "Mealie",
    "SMTP_FROM_EMAIL": null,
    "SMTP_AUTH_STRATEGY": "TLS",
    "LDAP_AUTH_ENABLED": false,
    "LDAP_SERVER_URL": null,
    "LDAP_TLS_INSECURE": false,
    "LDAP_TLS_CACERTFILE": null,
    "LDAP_ENABLE_STARTTLS": false,
    "LDAP_BASE_DN": null,
    "LDAP_QUERY_BIND": null,
    "LDAP_USER_FILTER": null,
    "LDAP_ADMIN_FILTER": null,
    "LDAP_ID_ATTRIBUTE": "uid",
    "LDAP_MAIL_ATTRIBUTE": "mail",
    "LDAP_NAME_ATTRIBUTE": "name",
    "OIDC_AUTH_ENABLED": false,
    "OIDC_CLIENT_ID": null,
    "OIDC_CONFIGURATION_URL": null,
    "OIDC_SIGNUP_ENABLED": true,
    "OIDC_USER_GROUP": null,
    "OIDC_ADMIN_GROUP": null,
    "OIDC_AUTO_REDIRECT": false,
    "OIDC_PROVIDER_NAME": "OAuth",
    "OIDC_REMEMBER_ME": false,
    "OIDC_USER_CLAIM": "email",
    "OIDC_GROUPS_CLAIM": "groups",
    "OIDC_TLS_CACERTFILE": null,
    "OPENAI_BASE_URL": null,
    "OPENAI_MODEL": "gpt-4o",
    "OPENAI_CUSTOM_HEADERS": {},
    "OPENAI_CUSTOM_PARAMS": {},
    "OPENAI_ENABLE_IMAGE_SERVICES": true,
    "OPENAI_WORKERS": 2,
    "OPENAI_SEND_DATABASE_DATA": true,
    "OPENAI_REQUEST_TIMEOUT": 60,
    "WORKER_PER_CORE": 1,
    "UVICORN_WORKERS": 1
}
INFO     2024-11-17T12:04:37 - Daily tasks scheduled for 2024-11-17 22:45:00+00:00
INFO     2024-11-17T12:04:37 - Application startup complete.
INFO     2024-11-17T12:04:37 - Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)
INFO     2024-11-17T12:04:47 - [127.0.0.1:53560] 200 OK "GET /api/app/about HTTP/1.1"

@jo-anb jo-anb changed the title 🐛 [meali] Environment variables not being imported from the config.yaml 🐛 [mealie] Environment variables not being imported from the config.yaml Nov 17, 2024
@jo-anb
Copy link
Author

jo-anb commented Nov 17, 2024

i even tried exporting them from the script addons_autoscripts/db21ed7f-mealie.sh. however the script is also not executed.

#!/bin/bash
# shellcheck shell=bash

#################
# CODE INJECTOR #
#################

# Any commands written in this bash script will be executed at addon start
# See guide here : https://github.com/alexbelgium/hassio-addons/wiki/Add%E2%80%90ons-feature-:-customisation

echo "############################################################# Starting sript execution #############################################################"

export LOG_LEVEL='debug'

log:


```INFO     2024-11-17T12:16:32 - -----SYSTEM SHUTDOWN----- 
INFO     2024-11-17T12:16:32 - Application shutdown complete.
INFO     2024-11-17T12:16:32 - Finished server process [7]
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Mealie
 Mealie is a self hosted recipe manager and meal planner built in Vue
-----------------------------------------------------------
 Add-on version: v2.1.0-2
 There is an update available for this add-on!
 Latest add-on version: v2.2.0
 Please consider upgrading as soon as possible.
 System: Home Assistant OS 13.2  (aarch64 / green)
 Home Assistant Core: 2024.11.1
 Home Assistant Supervisor: 2024.11.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID : 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
ALLOW_SIGNUP='false'
BASE_URL='http://homeassistant.local'
DATA_DIR='/config'
PGID='1000'
PUID='1000'
certfile='fullchain.pem'
keyfile='privkey.pem'
ssl='false'
Timezone set from Etc/UTC to Europe/Zurich
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory
Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f_mealie/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables
... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /addon_configs/db21ed7f_mealie/mealie.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/31-nginx.sh: executing
[12:16:52] INFO: Adapting for ingress
[12:16:53] INFO: Exporting variables
ALLOW_SIGNUP=false
BASE_URL=http://homeassistant.local
DATA_DIR=/config
PGID=1000
PUID=1000
certfile=fullchain.pem
keyfile=privkey.pem
ssl=false
[12:17:00] INFO: config.yaml found in /config/config.yaml, exporting variables
Permissions adapted
[12:17:00] INFO: Starting nginx
[12:17:00] INFO: Starting app
INFO     2024-11-17T12:18:09 - Started server process [7]
INFO     2024-11-17T12:18:09 - Waiting for application startup.
INFO     2024-11-17T12:18:09 - start: database initialization
INFO     2024-11-17T12:18:09 - Database connection established.
INFO     2024-11-17T12:18:09 - Context impl SQLiteImpl.
INFO     2024-11-17T12:18:09 - Will assume non-transactional DDL.
INFO     2024-11-17T12:18:09 - Checking for migration data fixes
INFO     2024-11-17T12:18:12 - end: database initialization
INFO     2024-11-17T12:18:12 - -----SYSTEM STARTUP-----
INFO     2024-11-17T12:18:12 - ------APP SETTINGS------
INFO     2024-11-17T12:18:12 - {
    "TESTING": false,
    "PRODUCTION": true,
    "LOG_CONFIG_OVERRIDE": null,
    "LOG_LEVEL": "info",
    "theme": {
...

@jo-anb
Copy link
Author

jo-anb commented Nov 17, 2024

I found the issue.
In the documentation https://github.com/alexbelgium/hassio-addons/wiki/Add%E2%80%90ons-feature-:-add-env-variables
it stated

The path is described in the starting log. To access it, you need to use my Filebrowser addon. Depending on the addon structure (old or new HA logic) you can look for the folder containing your addon name either in /addon_configs/XXX-name ; or in /homeassistant/addons_config/name. If you have started the addon at least once , it will contain a config.yaml file.

As i found the folders in /homeassitant i used those and did not look in the other directory.
However now i found i have the data in both locations /homeassistant/addons_config and /addons_config. when using the configs in the latter the addon does pick the variables up.

@jo-anb jo-anb closed this as completed Nov 17, 2024
@alexbelgium
Copy link
Owner

Indeed, /homeassistant are the folders pre-migration. I didn't delete it for continuity if people reload an older backup, but the log should make explicit which folder gets used. Glad it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants