Skip to content

Commit

Permalink
[MY_COMMIT] SUPPORT CUSTOM NOMINATIM API
Browse files Browse the repository at this point in the history
  • Loading branch information
senmizu committed Dec 9, 2024
1 parent 38cca3c commit b93412a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/ghcr_build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Build GHCR images

on:
workflow_dispatch:
push:
paths:
- "**/*"
- "!.github/**" # Important: Exclude PRs related to .github from auto-run
- "!.github/workflows/**" # Important: Exclude PRs related to .github from auto-run
branches: ["ci"]
pull_request_target:
branches: ["master", "ci"]
paths:
Expand Down Expand Up @@ -31,12 +38,12 @@ jobs:
- platform: "linux/amd64"
runs_on: "ubuntu-24.04"
cache_id: amd64
- platform: "linux/arm/v7"
runs_on: "buildjet-2vcpu-ubuntu-2204-arm"
cache_id: arm
- platform: "linux/arm64"
runs_on: "buildjet-2vcpu-ubuntu-2204-arm"
cache_id: arm64
# - platform: "linux/arm/v7"
# runs_on: "buildjet-2vcpu-ubuntu-2204-arm"
# cache_id: arm
# - platform: "linux/arm64"
# runs_on: "buildjet-2vcpu-ubuntu-2204-arm"
# cache_id: arm64

runs-on: ${{ matrix.runs_on }}
timeout-minutes: 10
Expand Down
2 changes: 1 addition & 1 deletion assets/js/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const DirectionArrow = CircleMarker.extend({
function createMap(opts) {
const map = new M(opts.elId != null ? `map_${opts.elId}` : "map", opts);

const osm = new TileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
const osm = new TileLayer("https://tile.thunderforest.com/atlas/{z}/{x}/{y}.png", {
maxZoom: 19,
});

Expand Down
3 changes: 3 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,6 @@ config :teslamate, :srtm_cache, System.get_env("SRTM_CACHE", ".srtm_cache")
config :teslamate, TeslaMate.Vault, key: Util.get_env("ENCRYPTION_KEY", test: "secret")

config :tzdata, :data_dir, System.get_env("TZDATA_DIR", "/tmp")

config :teslamate,
nominatim_api: System.get_env("NOMINATIM_API_HOST", "https://nominatim.openstreetmap.org")
2 changes: 1 addition & 1 deletion lib/teslamate/http.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule TeslaMate.HTTP do
@pools %{
System.get_env("TESLA_API_HOST", "https://owner-api.teslamotors.com") => [size: 10],
"https://nominatim.openstreetmap.org" => [size: 3],
System.get_env("NOMINATIM_API_HOST", "https://nominatim.openstreetmap.org") => [size: 3],
"https://api.github.com" => [size: 1],
:default => [size: 5]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/teslamate/locations/geocoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule TeslaMate.Locations.Geocoder do

adapter Tesla.Adapter.Finch, name: TeslaMate.HTTP, receive_timeout: 30_000

plug Tesla.Middleware.BaseUrl, "https://nominatim.openstreetmap.org"
plug Tesla.Middleware.BaseUrl, Application.get_env(:teslamate, :nominatim_api)
plug Tesla.Middleware.Headers, [{"user-agent", "TeslaMate/#{@version}"}]
plug Tesla.Middleware.JSON
plug Tesla.Middleware.Logger, debug: true, log_level: &log_level/1
Expand Down
2 changes: 2 additions & 0 deletions nix/flake-modules/formatter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"*.json.example"
"*.typos.toml"
"treefmt.toml"
".github/workflows/ghcr_build.yml"
"assets/js/hooks.js"
"grafana/dashboards/*.json" # we use the grafana export style
];
programs.mix-format.enable = true;
Expand Down

0 comments on commit b93412a

Please sign in to comment.