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

chore: enable full ENV support and remove --sqlite option #6286

Merged
merged 3 commits into from
Feb 17, 2023
Merged

Conversation

andig
Copy link
Member

@andig andig commented Feb 17, 2023

/cc @pauxus @goebelmeier funktioniert das mit dem ENV im Servicefile?

packaging/init/evcc.service Outdated Show resolved Hide resolved
andig and others added 2 commits February 17, 2023 17:27
Co-authored-by: Stephan Pauxberger <stephan@blackbuild.com>
@andig andig merged commit 5fb48d0 into master Feb 17, 2023
@andig andig deleted the feature/env branch February 17, 2023 17:03
@ca-dmin
Copy link
Contributor

ca-dmin commented Feb 18, 2023

@andig

Ich glaube die Änderung funktioniert nicht, zumindest hier bei mir:
docker/bin/entrypoint.sh

            echo "starting evcc: 'EVCC_DATABASE_DSN=${SQLITE_FILE} evcc --config ${CONFIG}'"
            exec EVCC_DATABASE_DSN="${SQLITE_FILE}" evcc --config "${CONFIG}"

Exec mag dann nicht:

/app/entrypoint.sh: exec: line 19: EVCC_DATABASE_DSN=/data/evcc.db: not found
Using config file: /config/evcc.yaml
starting evcc: 'EVCC_DATABASE_DSN=/data/evcc.db evcc --config /config/evcc.yaml'

möglicher Workaround (ungetestet mangels Zeit heute)

            export EVCC_DATABASE_DSN="${SQLITE_FILE}"
            evcc --config "${CONFIG}" &
            exec sleep infinity

@andig
Copy link
Member Author

andig commented Feb 18, 2023

Da müsst ihr mir helfen, ich bin da leider kein Experte und mir fehlt das Linux zum testen. Gerne PR mit Bugfix.

@ca-dmin
Copy link
Contributor

ca-dmin commented Feb 18, 2023

Update:
So sollte es gehen:
exec env EVCC_DATABASE_DSN="${SQLITE_FILE}" evcc --config "${CONFIG}"

Lt. Proc ist die Variable dann auch im Environment des Prozesses.
Aber meine Ladevorgänge sind nicht mehr sichtbar - als würde evcc die DB nicht mehr öffnen.

Update 2
cmd/setup.go:
Dort ist: conf.Database.Dsn == ~/.evcc/evcc.db
in os.Environ() ist es sichtbar: EVCC_DATABASE_DSN=/data/evcc.db
Sprich das EVCC_DATABASE_DSN wird nicht ausgelesen --> viper?

Update 3
Klappt nur, wenn in der evcc.yml ein Eintrag fuer database-dns ist:

database:
  dsn: "evcc.db-egal-was"

Diff:

index 8f537ec0..a346c7be 100755
--- a/docker/bin/entrypoint.sh
+++ b/docker/bin/entrypoint.sh
@@ -16,7 +16,7 @@ if [ -f ${HASSIO_OPTIONSFILE} ]; then
     else
         if [ "${SQLITE_FILE}" ]; then
             echo "starting evcc: 'EVCC_DATABASE_DSN=${SQLITE_FILE} evcc --config ${CONFIG}'"
-            exec EVCC_DATABASE_DSN="${SQLITE_FILE}" evcc --config "${CONFIG}"
+            exec env EVCC_DATABASE_DSN="${SQLITE_FILE}" evcc --config "${CONFIG}"
         else
             echo "starting evcc: 'evcc --config ${CONFIG}'"
             exec evcc --config "${CONFIG}"

Läuft dann damit:

Using config file: /config/evcc.yaml
starting evcc: 'EVCC_DATABASE_DSN=/data/evcc.db evcc --config /config/evcc.yaml'

@ca-dmin
Copy link
Contributor

ca-dmin commented Feb 18, 2023

Pull-Request:
#6306

Schau mal bitte, ob ich das richtig gemacht habe - ist der erste pull request

@ca-dmin ca-dmin mentioned this pull request Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants