fix parser version check
This commit is contained in:
parent
bd534da1ac
commit
42bac34073
1 changed files with 15 additions and 6 deletions
|
|
@ -3,18 +3,18 @@ defmodule Aprsme.DependencyInfo do
|
||||||
Provides information about dependencies, particularly for production builds.
|
Provides information about dependencies, particularly for production builds.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Store parser git hash at compile time
|
||||||
|
@parser_git_hash get_static_parser_hash()
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gets the SHA1 hash of the aprs library currently being used.
|
Gets the SHA1 hash of the aprs library currently being used.
|
||||||
In development: reads from vendor/aprs directory
|
In development: reads from vendor/aprs directory
|
||||||
In production: fetches from GitHub API
|
In production: uses the hash captured at build time
|
||||||
"""
|
"""
|
||||||
def get_aprs_library_sha do
|
def get_aprs_library_sha do
|
||||||
if Application.get_env(:aprsme, :env, :dev) == :prod do
|
if Application.get_env(:aprsme, :env, :dev) == :prod do
|
||||||
# In production, use environment variable set during build if available
|
# In production, use the static hash captured at compile time
|
||||||
case System.get_env("PARSER_GIT_HASH") do
|
@parser_git_hash
|
||||||
nil -> fetch_aprs_sha_from_github()
|
|
||||||
hash -> hash
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
get_aprs_sha_from_vendor()
|
get_aprs_sha_from_vendor()
|
||||||
end
|
end
|
||||||
|
|
@ -54,4 +54,13 @@ defmodule Aprsme.DependencyInfo do
|
||||||
def is_latest_aprs_library? do
|
def is_latest_aprs_library? do
|
||||||
get_aprs_library_sha() == latest_aprs_library_sha()
|
get_aprs_library_sha() == latest_aprs_library_sha()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 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
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue