Skip to content

Commit

Permalink
Prepare for Release 21.01
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultmeyer committed Jan 6, 2021
1 parent 761490f commit a9ac06c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.play-rconf</groupId>
<artifactId>play-rconf-git</artifactId>
<version>20.10</version>
<version>21.01</version>
<name>Play Remote Configuration - GIT</name>
<description>Retrieves configuration hosted on a GIT repository</description>
<url>https://github.com/play-rconf/play-rconf-git</url>
Expand Down
30 changes: 16 additions & 14 deletions src/main/java/io/playrconf/provider/GitProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
/**
* Retrieves configuration hosted behind a Git repository.
* You can use three authentication modes:
* 1. None (Used for public repositories);
* 2. User (Used for private repositories over HTTPS);
* 3. SSH-RSA (Used for private repositories over SSH with a RSA Private Key).
* 1. None (Used for public repositories);
* 2. User (Used for private repositories over HTTPS);
* 3. SSH-RSA (Used for private repositories over SSH with a RSA Private Key).
*
* @author Felipe Bonezi
* @since 20.10.29
Expand Down Expand Up @@ -173,7 +173,8 @@ public void loadData(final Config config,

/**
* Check if all required fields are set in the project config file.
* @param config Config file.
*
* @param config Config file
*/
private void checkRequiredConfigFields(final Config config) throws ConfigException {
if (!config.hasPath("mode") || config.getString("mode").isEmpty())
Expand Down Expand Up @@ -212,10 +213,10 @@ private void checkRequiredConfigFields(final Config config) throws ConfigExcepti
/**
* Clones main branch of Git repository.
*
* @param config Config file.
* @param repositoryURI Repository URI using HTTPS or SSH.
* @param mode Auth mode.
* @return Repository.
* @param config Config file
* @param repositoryURI Repository URI using HTTPS or SSH
* @param mode Auth mode
* @return Repository
*/
private Repository cloneRepository(final Config config, final String repositoryURI, final String mode) throws GitAPIException, IOException {
final String dirPath = String.format("play-rconf-git-%s", System.currentTimeMillis());
Expand All @@ -230,7 +231,7 @@ private Repository cloneRepository(final Config config, final String repositoryU

@Override
protected JSch createDefaultJSch(final FS fs) throws JSchException {
// SSH configuration (Optional password).
// SSH configuration (Optional password)
final String privateKey = config.getString("ssh-rsa.private-key");
final String password = config.hasPath("ssh-rsa.password")
? config.getString("ssh-rsa.password") : null;
Expand All @@ -253,7 +254,7 @@ protected JSch createDefaultJSch(final FS fs) throws JSchException {
break;

default:
// Public repository over HTTPS.
// Public repository over HTTPS
break;
}

Expand All @@ -262,10 +263,11 @@ protected JSch createDefaultJSch(final FS fs) throws JSchException {

/**
* Read config file from repository.
* @param repository Repository ref.
* @param commit Last commit ref from the main branch.
* @param filepath Path to retrieve the config content.
* @return Config content as String.
*
* @param repository Repository ref
* @param commit Last commit ref from the main branch
* @param filepath Path to retrieve the config content
* @return Config content as String
*/
private String readFile(final Repository repository, final RevCommit commit, final String filepath) throws IOException {
final TreeWalk walk = TreeWalk.forPath(repository, filepath, commit.getTree());
Expand Down
22 changes: 12 additions & 10 deletions src/test/java/io/playrconf/provider/GitProviderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@

/**
* GitProviderTest.
*
* <p>
* Default environment variables:
* 1. REMOTECONF_GIT_BRANCH
* 2. REMOTECONF_GIT_FILEPATH
*
* 1. REMOTECONF_GIT_BRANCH
* 2. REMOTECONF_GIT_FILEPATH
* </p>
* <p>
* Required environment variables:
* 1. For none mode:
* a) REMOTECONF_GIT_URI
* 2. For user mode:
* a) REMOTECONF_GIT_USER_URI
* b) REMOTECONF_GIT_USER_LOGIN
* c) REMOTECONF_GIT_USER_PASSWORD
* 1. For none mode:
* a) REMOTECONF_GIT_URI
* 2. For user mode:
* a) REMOTECONF_GIT_USER_URI
* b) REMOTECONF_GIT_USER_LOGIN
* c) REMOTECONF_GIT_USER_PASSWORD
* </p>
*
* @author Felipe Boenzi
* @since 20.10.29
Expand Down

0 comments on commit a9ac06c

Please sign in to comment.