Skip to content

Commit

Permalink
GH-35 Cleanup configuration (Resolve #35)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed May 14, 2020
1 parent 37a04cc commit 0ce4182
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 91 deletions.
69 changes: 25 additions & 44 deletions src/main/java/org/panda_lang/nanomaven/NanoConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,40 @@

package org.panda_lang.nanomaven;

import java.io.Serializable;
import java.util.List;

public final class NanoConfiguration {
public final class NanoConfiguration implements Serializable {

private int port;
private String hostname;

private int port;
private List<String> repositories;
private boolean repositoryPathEnabled;
private boolean indexingEnabled;
private boolean deployEnabled;
private boolean rewritePathsEnabled;
private boolean fullAuthEnabled;

private boolean nestedMaven;
private String externalMaven;

public boolean isDeployEnabled() {
return deployEnabled;
public void setHostname(String hostname) {
this.hostname = hostname;
}

public String getExternalMaven() {
return externalMaven;
public void setPort(int port) {
this.port = port;
}

public boolean isNestedMaven() {
return nestedMaven;
public void setRepositories(List<String> repositories) {
this.repositories = repositories;
}

public boolean isIndexingEnabled() {
return indexingEnabled;
public void setDeployEnabled(boolean deployEnabled) {
this.deployEnabled = deployEnabled;
}

public boolean isRepositoryPathEnabled() {
return repositoryPathEnabled;
public void setRewritePathsEnabled(boolean rewritePathsEnabled) {
this.rewritePathsEnabled = rewritePathsEnabled;
}

public List<? extends String> getRepositories() {
return repositories;
public void setFullAuthEnabled(boolean fullAuthEnabled) {
this.fullAuthEnabled = fullAuthEnabled;
}

public String getHostname() {
Expand All @@ -63,36 +60,20 @@ public int getPort() {
return port;
}

public void setPort(int port) {
this.port = port;
}

public void setHostname(String hostname) {
this.hostname = hostname;
}

public void setRepositories(List<String> repositories) {
this.repositories = repositories;
}

public void setRepositoryPathEnabled(boolean repositoryPathEnabled) {
this.repositoryPathEnabled = repositoryPathEnabled;
}

public void setIndexingEnabled(boolean indexingEnabled) {
this.indexingEnabled = indexingEnabled;
public List<String> getRepositories() {
return repositories;
}

public void setNestedMaven(boolean nestedMaven) {
this.nestedMaven = nestedMaven;
public boolean isDeployEnabled() {
return deployEnabled;
}

public void setExternalMaven(String externalMaven) {
this.externalMaven = externalMaven;
public boolean isRewritePathsEnabled() {
return rewritePathsEnabled;
}

public void setDeployEnabled(boolean deployEnabled) {
this.deployEnabled = deployEnabled;
public boolean isFullAuthEnabled() {
return fullAuthEnabled;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public final class Authenticator {

private TokenService tokenService;
private final TokenService tokenService;

public Authenticator(TokenService tokenService) {
this.tokenService = tokenService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private String normalizeUri(NanoConfiguration configuration, String uri) {
return StringUtils.EMPTY;
}

if (configuration.isRepositoryPathEnabled()) {
if (!configuration.isRewritePathsEnabled()) {
return uri;
}

Expand Down
23 changes: 8 additions & 15 deletions src/main/resources/nanomaven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,22 @@
# Nano Maven #
# ~~~~~~~~~~~~~~~~~~~~~~ #

# General Repository Name
repositoryName: NanoMaven Repository

# Hostname
hostname: ''
# Port
port: 80

# Include a repository names in the path
repositoryPathEnabled: false
# Enable directory indexing
indexingEnabled: true

# Root directories of repositories.
# List of supported Maven repositories.
# First directory on the list is the main repository.
repositories:
- releases
- snapshots

# Nested Maven
nestedMaven: true
# External Maven directory (if 'nested-maven': false)
externalMaven: /usr/local/share/java/maven33

# Accept deployment connections
deployEnabled: true
deployEnabled: true
# Allow to omit name of the main repository in request
# e.g. /org/panda-lang/nanomaven will be redirected to /releases/org/panda-lang/nanomaven
rewritePathsEnabled: true
# Require authentication of all requests (download, head requests)
# This option should be set to 'false', if you are hosting public repository
fullAuthEnabled: false
30 changes: 0 additions & 30 deletions src/test/workspace/nanomaven.yml

This file was deleted.

0 comments on commit 0ce4182

Please sign in to comment.