Compare commits

..

No commits in common. "main" and "refactor" have entirely different histories.

5 changed files with 15 additions and 46 deletions

View file

@ -1,31 +0,0 @@
name: ci
on:
push:
branches:
- "cicd"
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: forge.k3s.fr
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: forge.k3s.fr/elevation-api-eu/server:latest

View file

@ -2,11 +2,10 @@ FROM docker.io/lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app
FROM chef AS planner
COPY Cargo.* .
ADD src src
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
FROM chef AS builder
RUN apt update && apt install -y clang libgdal-dev
RUN apt install -y libclang-dev
COPY --from=planner /app/recipe.json recipe.json

View file

@ -15,7 +15,7 @@
}
header {
background: #1CD4FF;
background: #007BFF;
color: #ffffff;
padding: 10px 20px;
text-align: center;
@ -32,7 +32,7 @@
footer {
text-align: center;
padding: 10px 0;
background: #1CD4FF;
background: #007BFF;
color: white;
/*position: fixed;*/
bottom: 0;
@ -94,14 +94,12 @@
<p>The digital elevation data comes from ESA's Copernicus program.</p>
<h3>Rate limits</h3>
<p>Don't be an idiot. Less than 10/s is okay</p>
<h3>Source code</h3>
<p><a href="https://forge.k3s.fr/elevation-api-eu/api-server">https://forge.k3s.fr/elevation-api-eu/api-server</a></p>
<h3>Contact</h3>
<p>For more information, you can reach me at f@vi-di.fr. Patches welcome!</p>
<p>For more information, you can reach me at f@vi-di.fr</p>
</section>
<footer>
<p>© 2024 <a href="https://frank.villaro-dixon.eu">Frank Villaro-Dixon</a>. No rights reserved. Made with love in 🇨🇭 and 🇫🇷</p>
<p>© 2024 Frank Villaro-Dixon. No rights reserved</p>
</footer>
</body>
</html>
</html>

View file

@ -37,7 +37,7 @@ impl DatasetRepository {
info!("Will open {full_filename} because not in cache!");
let ds = Dataset::open(full_filename.clone());
match ds {
Err(_) => {
Err(x) => {
error!("File not present");
return None;
}

View file

@ -10,7 +10,7 @@ use axum::{
use axum_macros::debug_handler;
use std::env;
use serde::ser::SerializeSeq;
use serde::ser::{SerializeSeq, Serializer};
use serde::{Deserialize, Deserializer, Serialize};
use serde_qs::axum::{QsQueryConfig, QsQueryRejection};
use tower_http::trace::TraceLayer;
@ -105,8 +105,8 @@ async fn main() {
.with_state(cache)
.layer(
TraceLayer::new_for_http()
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
.make_span_with(trace::DefaultMakeSpan::new().level(Level::DEBUG))
.on_response(trace::DefaultOnResponse::new().level(Level::DEBUG)),
)
.layer(Extension(QsQueryConfig::new(5, false).error_handler(
|err| {
@ -130,6 +130,9 @@ async fn get_elevation(
query_opts: Query<Opts>,
Path((lat, lon)): Path<(f64, f64)>,
) -> Response {
println!("lat: {}, lon: {}", lat, lon);
println!("query_opts: {:?}", query_opts);
let ele;
match dem::elevation_from_coordinates(&dsr, lat, lon).await {
Ok(x) => match x {
@ -144,7 +147,7 @@ async fn get_elevation(
#[derive(Serialize)]
struct Ele {
elevation: f64,
}
};
if query_opts.json {
let r = Ele { elevation: ele };