fix parser version check

This commit is contained in:
Graham McIntire 2025-07-07 14:16:55 -05:00
parent cfdaf954d5
commit 6cebd03d7f
No known key found for this signature in database
2 changed files with 20 additions and 5 deletions

View file

@ -67,8 +67,8 @@ RUN date -u +"%Y-%m-%dT%H:%M:%SZ" > /app/deployed_at.txt
# Copy parser hash from builder stage
COPY --from=builder /tmp/parser_hash.txt /app/parser_hash.txt
# Set parser git hash environment variable for runtime
ENV PARSER_GIT_HASH=$(cat /app/parser_hash.txt)
# Set default parser git hash environment variable
ENV PARSER_GIT_HASH="unknown"
# Copy release from builder
COPY --from=builder --chown=nobody:root /app/release ./

View file

@ -55,9 +55,24 @@ defmodule Aprsme.DependencyInfo do
# Get static parser hash at compile time
defp get_static_parser_hash do
case System.get_env("PARSER_GIT_HASH") do
nil -> "unknown"
"unknown" -> "unknown"
hash -> hash
nil ->
"unknown"
"unknown" ->
# Try to read from the file copied during build
hash_file = Path.join(["/app", "parser_hash.txt"])
if File.exists?(hash_file) do
case File.read(hash_file) do
{:ok, hash} -> String.trim(hash)
_ -> "unknown"
end
else
"unknown"
end
hash ->
hash
end
end
end