diff --git a/bruno/Insert.bru b/bruno/Insert.bru
index 4516feb..71399fd 100644
--- a/bruno/Insert.bru
+++ b/bruno/Insert.bru
@@ -5,7 +5,7 @@ meta {
}
post {
- url: http://localhost:8080/api/metrics/POD-2/WORKLOAD
+ url: http://localhost:4000/api/metrics/POD-2/WORKLOAD
body: json
auth: basic
}
@@ -15,17 +15,17 @@ headers {
}
auth:basic {
- username: michaeltheduck
- password: blabla
+ username: test
+ password: test
}
body:json {
{
"owner": "kubooboo",
"values": {
- "RELATIVE_CPU": "20",
- "RELATIVE_MEMORY": "23",
- "RELATIVE_DISK_USAGE": "56"
+ "x": "20",
+ "y": "23",
+ "z": "56"
}
}
}
diff --git a/pom.xml b/pom.xml
index f48772c..6e04ecb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,14 @@
io.quarkus
quarkus-smallrye-jwt
+
+ io.quarkus
+ quarkus-flyway
+
+
+ org.flywaydb
+ flyway-database-postgresql
+
diff --git a/src/main/java/dev/dinauer/metrics/service/client/auth/BearerAuthClientProvider.java b/src/main/java/dev/dinauer/metrics/service/client/auth/BearerAuthClientProvider.java
index d3f1458..0976482 100644
--- a/src/main/java/dev/dinauer/metrics/service/client/auth/BearerAuthClientProvider.java
+++ b/src/main/java/dev/dinauer/metrics/service/client/auth/BearerAuthClientProvider.java
@@ -2,11 +2,7 @@ package dev.dinauer.metrics.service.client.auth;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
-import jakarta.ws.rs.WebApplicationException;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.Response;
-import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.jwt.JsonWebToken;
import org.jboss.resteasy.reactive.common.NotImplementedYet;
@@ -22,15 +18,8 @@ public class BearerAuthClientProvider
@Inject
JWTParser parser;
- @ConfigProperty(name = "big.bucket.auth.client-only")
- Boolean clientOnly;
-
public Client get(String credentials)
{
- if (clientOnly)
- {
- throw new WebApplicationException(Response.status(403).type(MediaType.TEXT_PLAIN).entity("endusers_disabled").build());
- }
try
{
JsonWebToken token = parser.parse(credentials);
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 595b7a2..cca93a9 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -7,22 +7,20 @@ quarkus.http.root-path=/api/metrics
big.bucket.units=RAW,HOURLY,DAILY,WEEKLY,MONTHLY,YEARLY,TOTAL
-dev.dinauer.metrics-service.client.kubooboo.ro=3749832748923748923
-dev.dinauer.metrics-service.jwt.client.field=upn
-
quarkus.smallrye-jwt.enabled=false
-%dev.big.bucket.auth.client-only=false
# Postgres
quarkus.datasource.db-kind = postgresql
%dev.quarkus.datasource.username = postgres
%dev.quarkus.datasource.password = postgres
%dev.quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:8888/postgres
-%dev,test.quarkus.hibernate-orm.schema-management.strategy=drop-and-create
# Prod
%prod.quarkus.datasource.username=${DB_USER}
%prod.quarkus.datasource.password=${DB_PASSWORD}
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_DATABASE}?currentSchema=${DB_SCHEMA}
-%prod.quarkus.hibernate-orm.schema-management.strategy=drop-and-create
-quarkus.banner.path=banner.txt
\ No newline at end of file
+quarkus.banner.path=banner.txt
+
+# Flyway
+%test,dev.quarkus.flyway.clean-at-start=true
+quarkus.flyway.migrate-at-start=true
\ No newline at end of file
diff --git a/src/main/resources/db/migration/V1.0.0__init.sql b/src/main/resources/db/migration/V1.0.0__init.sql
new file mode 100644
index 0000000..b338da4
--- /dev/null
+++ b/src/main/resources/db/migration/V1.0.0__init.sql
@@ -0,0 +1,14 @@
+CREATE TABLE public.bucket (
+ created_at timestamptz(6) NULL,
+ unix_timestamp int8 NOT NULL,
+ updated_at timestamptz(6) NULL,
+ bucket_name varchar(255) NOT NULL,
+ bucket_unit varchar(255) NOT NULL,
+ id varchar(255) NOT NULL,
+ metrics text NOT NULL,
+ "owner" varchar(255) NULL,
+ resource varchar(255) NOT NULL,
+ "timestamp" varchar(255) NOT NULL,
+ CONSTRAINT bucket_bucket_unit_check CHECK (((bucket_unit)::text = ANY ((ARRAY['RAW'::character varying, 'HOURLY'::character varying, 'DAILY'::character varying, 'WEEKLY'::character varying, 'MONTHLY'::character varying, 'YEARLY'::character varying, 'TOTAL'::character varying])::text[]))),
+ CONSTRAINT bucket_pkey PRIMARY KEY (id)
+);
\ No newline at end of file