Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

101 dashboard #109

Merged
merged 4 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ USER 2021:2020

COPY target/dependency /usr/lib/web-service/lib
COPY target/${JAR_FILE} /usr/lib/web-service/app.jar
COPY _config.yml /etc/artipie/artipie.yml

WORKDIR /var/web-service
HEALTHCHECK --interval=10s --timeout=3s \
Expand All @@ -28,7 +27,5 @@ CMD [ \
"--add-opens", "java.base/java.util=ALL-UNNAMED", \
"--add-opens", "java.base/java.security=ALL-UNNAMED", \
"-cp", "/usr/lib/web-service/app.jar:/usr/lib/web-service/lib/*", \
"com.artipie.front.Service", \
"--port=8080", \
"--config=/etc/artipie/artipie.yml" \
"com.artipie.front.Service" \
]
14 changes: 0 additions & 14 deletions _config.yml

This file was deleted.

15 changes: 0 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,6 @@ https://github.com/artipie/front/LICENSE.txt
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
<version>2.14.7</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<version>2.14.7</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>0.5.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/com/artipie/front/AuthFilters.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum AuthFilters implements Filter {
*/
AUTHENTICATE(
(req, rsp) -> {
if (req.pathInfo().equals("/signin") || req.pathInfo().equals("/token")) {
if ("/signin".equals(req.pathInfo()) || "/.health".equals(req.pathInfo())) {
return;
}
if (req.session() == null || !req.session().attributes().contains("uid")) {
Expand All @@ -43,16 +43,17 @@ public enum AuthFilters implements Filter {
);
if (req.session() == null) {
attrs.values().forEach(attr -> attr.remove(req));
}
attrs.forEach(
(name, attr) -> {
if (req.session().attributes().contains(name)) {
attr.write(req, req.session().attribute(name));
} else {
attr.remove(req);
} else {
attrs.forEach(
(name, attr) -> {
if (req.session().attributes().contains(name)) {
attr.write(req, req.session().attribute(name));
} else {
attr.remove(req);
}
}
}
);
);
}
}
);

Expand All @@ -71,8 +72,6 @@ public enum AuthFilters implements Filter {

@Override
public void handle(final Request req, final Response rsp) throws Exception {
if (!req.pathInfo().startsWith("/api")) {
this.func.handle(req, rsp);
}
this.func.handle(req, rsp);
}
}
42 changes: 42 additions & 0 deletions src/main/java/com/artipie/front/Layout.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* The MIT License (MIT) Copyright (c) 2022 artipie.com
* https://github.com/artipie/front/LICENSE.txt
*/
package com.artipie.front;

/**
* Repository layout.
*
* @since 1.0
*/
public enum Layout {
/**
* Flat layout.
*/
FLAT("flat"),
/**
* Org layout.
*/
ORG("org");

/**
* Name of layout.
*/
private final String name;

/**
* Ctor.
* @param name Name of layout.
*/
Layout(final String name) {
this.name = name;
}

/**
* The name of the layout.
* @return String name
*/
public String toString() {
return this.name;
}
}
64 changes: 64 additions & 0 deletions src/main/java/com/artipie/front/RestException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* The MIT License (MIT) Copyright (c) 2022 artipie.com
* https://github.com/artipie/front/LICENSE.txt
*/
package com.artipie.front;

import com.artipie.ArtipieException;

/**
* Exception should be used in wrong result of rest-invocation.
*
* @since 1.0
* @implNote RestException is unchecked exception, but it's a good
* practice to document it via {@code throws} tag in JavaDocs.
*/
@SuppressWarnings("PMD.OnlyOneConstructorShouldDoInitialization")
public class RestException extends ArtipieException {
private static final long serialVersionUID = 1L;

/**
* Status code.
*/
private final int code;

/**
* New exception with message and base cause.
* @param code Http status code
* @param msg Message
* @param cause Cause
*/
public RestException(final int code, final String msg, final Throwable cause) {
super(msg, cause);
this.code = code;
}

/**
* New exception with base cause.
* @param code Http status code
* @param cause Cause
*/
public RestException(final int code, final Throwable cause) {
super(cause);
this.code = code;
}

/**
* New exception with message.
* @param code Http status code
* @param msg Message
*/
public RestException(final int code, final String msg) {
super(msg);
this.code = code;
}

/**
* Get http status code of rest invocation's result .
* @return Status code.
*/
public int statusCode() {
return this.code;
}
}

Loading