Make RDE SSH key identity injectable

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133883090
This commit is contained in:
Hans Ridder 2016-09-21 15:23:00 -07:00 committed by Ben McIlwain
parent 28eeda189d
commit 2d46c7c27c
3 changed files with 16 additions and 1 deletions

View file

@ -21,6 +21,7 @@ import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import dagger.Module;
import dagger.Provides;
import google.registry.config.ConfigModule.Config;
import google.registry.keyring.api.KeyModule.Key;
/** Dagger module for {@link JSch} which provides SSH/SFTP connectivity. */
@ -29,13 +30,14 @@ public final class JSchModule {
@Provides
static JSch provideJSch(
@Config("rdeSshIdentity") String identity,
@Key("rdeSshClientPrivateKey") String privateKey,
@Key("rdeSshClientPublicKey") String publicKey) {
applyAppEngineKludge();
JSch jsch = new JSch();
try {
jsch.addIdentity(
"rde@charlestonroadregistry.com",
identity,
privateKey.getBytes(UTF_8),
publicKey.getBytes(UTF_8),
null);