Create cache directory

This commit is contained in:
Adrian Kumpf
2019-08-27 21:13:31 +02:00
parent 9bd859dadf
commit 3cd0af570d
3 changed files with 5 additions and 9 deletions

View File

@@ -26,7 +26,8 @@ RUN mkdir -p /opt/built && mix release --path /opt/built
FROM alpine:3.9 AS app
ENV LANG=C.UTF-8
ENV LANG=C.UTF-8 \
SRTM_CACHE=/opt/app/.srtm_cache
RUN apk add --update --no-cache bash openssl tzdata
@@ -34,7 +35,7 @@ WORKDIR /opt/app
COPY --chown=nobody entrypoint.sh /
COPY --from=builder --chown=nobody /opt/built .
RUN chown nobody: .
RUN mkdir .srtm_cache && chown -R nobody: .
USER nobody

View File

@@ -51,4 +51,4 @@ if System.get_env("ENABLE_LOGGER_TELEGRAM") == "true" do
token: System.fetch_env!("TOKEN")
end
config :teslamate, :srtm_cache, System.get_env("SRTM_CACHE", "/tmp/srtm_cache")
config :teslamate, :srtm_cache, System.get_env("SRTM_CACHE", ".srtm_cache")

View File

@@ -6,7 +6,7 @@ defmodule TeslaMate.Mapping do
alias TeslaMate.Log.Position
alias TeslaMate.Log
defstruct [:client, :timeout, :blocked_on, :deps, :name]
defstruct [:client, :timeout, :deps, :name]
alias __MODULE__, as: Data
@name __MODULE__
@@ -22,10 +22,7 @@ defmodule TeslaMate.Mapping do
end
# TODO
# * Add Docker Volume for caches
# * Grafana: m to ft
# * Test get_positions_without_elevation
# * Test update_position
# Callbacks
@@ -75,8 +72,6 @@ defmodule TeslaMate.Mapping do
def handle_event(event, {:fetch_positions, min_id}, :ready, %Data{} = data)
when event in [:internal, :state_timeout] do
Logger.info("Updating positions ...")
case call(data.deps.log, :get_positions_without_elevation, [min_id, [limit: 100]]) do
{[], nil} ->
{:keep_state_and_data, schedule_fetch()}