MCPcopy Index your code
hub / github.com/GerritCodeReview/gerrit / InitSendEmail

Class InitSendEmail

java/com/google/gerrit/pgm/init/InitSendEmail.java:30–63  ·  view source on GitHub ↗

Initialize the sendemail configuration section.

Source from the content-addressed store, hash-verified

28
29/** Initialize the {@code sendemail} configuration section. */
30@Singleton
31class InitSendEmail implements InitStep {
32 private final ConsoleUI ui;
33 private final Section sendemail;
34 private final SitePaths site;
35
36 @Inject
37 InitSendEmail(ConsoleUI ui, SitePaths site, Section.Factory sections) {
38 this.ui = ui;
39 this.sendemail = sections.get("sendemail", null);
40 this.site = site;
41 }
42
43 @Override
44 public void run() {
45 ui.header("Email Delivery");
46
47 final String hostname = sendemail.string("SMTP server hostname", "smtpServer", "localhost");
48
49 sendemail.string("SMTP server port", "smtpServerPort", "(default)", true);
50
51 final Encryption enc =
52 sendemail.select("SMTP encryption", "smtpEncryption", Encryption.NONE, true);
53
54 String username = null;
55 if (Files.exists(site.gerrit_config)) {
56 username = sendemail.get("smtpUser");
57 } else if ((enc != null && enc != Encryption.NONE) || !isLocal(hostname)) {
58 username = username();
59 }
60 sendemail.string("SMTP username", "smtpUser", username);
61 sendemail.password("smtpUser", "smtpPass");
62 }
63}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected