Skip to content

Commit

Permalink
env instead of manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 24, 2024
1 parent 3766980 commit ce7e085
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 65 deletions.
13 changes: 6 additions & 7 deletions src/main/java/com/rultor/Entry.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import com.jcabi.github.mock.MkGithub;
import com.jcabi.github.wire.RetryCarefulWire;
import com.jcabi.log.Logger;
import com.jcabi.manifests.Manifests;
import com.jcabi.urn.URN;
import com.rultor.cached.CdTalks;
import com.rultor.dynamo.DyTalks;
Expand Down Expand Up @@ -101,7 +100,7 @@ public static void main(final String... args) throws IOException {
* @throws IOException If fails
*/
public void exec() throws IOException {
final String dsn = Manifests.read("Rultor-SentryDsn");
final String dsn = Env.read("Rultor-SentryDsn");
if (!dsn.startsWith("test")) {
Sentry.init(dsn);
}
Expand Down Expand Up @@ -133,7 +132,7 @@ public void exec() throws IOException {
@Cacheable(forever = true)
private Github github() throws IOException {
Logger.info(this, "Connecting GitHub...");
final String token = Manifests.read("Rultor-GithubToken");
final String token = Env.read("Rultor-GithubToken");
final Github github;
if (token.startsWith("${")) {
github = new MkGithub();
Expand Down Expand Up @@ -164,8 +163,8 @@ private Sttc sttc() throws IOException {
final Sttc sttc = new CdSttc(
new ReSttc(
RtSttc.make(
URN.create(Manifests.read("Rultor-SttcUrn")),
Manifests.read("Rultor-SttcToken")
URN.create(Env.read("Rultor-SttcUrn")),
Env.read("Rultor-SttcToken")
)
)
);
Expand All @@ -184,10 +183,10 @@ private Sttc sttc() throws IOException {
@Cacheable(forever = true)
private Region dynamo() {
Logger.info(this, "Connecting DynamoDB...");
final String key = Manifests.read("Rultor-DynamoKey");
final String key = Env.read("Rultor-DynamoKey");
Credentials creds = new Credentials.Simple(
key,
Manifests.read("Rultor-DynamoSecret")
Env.read("Rultor-DynamoSecret")
);
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/rultor/Toggles.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import com.jcabi.aspects.Immutable;
import com.jcabi.log.Logger;
import com.jcabi.manifests.Manifests;
import java.io.File;
import java.io.IOException;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -72,7 +71,7 @@ final class InFile implements Toggles {
* Directory to work in.
*/
private static final String DIR = String.format(
"/tmp/rultor-%s", Manifests.read("Rultor-Revision")
"/tmp/rultor-%s", Env.read("Rultor-Revision")
);

@Override
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/com/rultor/agents/Agents.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.github.Github;
import com.jcabi.immutable.Array;
import com.jcabi.manifests.Manifests;
import com.jcabi.s3.Region;
import com.jcabi.s3.retry.ReRegion;
import com.jcabi.ssh.Ssh;
import com.rultor.Env;
import com.rultor.agents.aws.AwsEc2;
import com.rultor.agents.aws.ConnectsInstance;
import com.rultor.agents.aws.DescribesInstance;
Expand Down Expand Up @@ -171,8 +171,8 @@ public Agents(final Github ghub, final Sttc stc) {
*/
public SuperAgent starter() throws IOException {
final AwsEc2 aws = new AwsEc2(
Manifests.read("Rultor-EC2Key"),
Manifests.read("Rultor-EC2Secret")
Env.read("Rultor-EC2Key"),
Env.read("Rultor-EC2Secret")
);
return new SuperAgent.Iterative(
new Array<>(
Expand Down Expand Up @@ -273,8 +273,8 @@ public Agent agent(final Talk talk, final Profile profile)
)
);
final AwsEc2 aws = new AwsEc2(
Manifests.read("Rultor-EC2Key"),
Manifests.read("Rultor-EC2Secret")
Env.read("Rultor-EC2Key"),
Env.read("Rultor-EC2Secret")
);
return new VerboseAgent(
new Agent.Iterative(
Expand All @@ -291,10 +291,10 @@ public Agent agent(final Talk talk, final Profile profile)
new StartsInstance(
profile,
aws,
Manifests.read("Rultor-EC2Image"),
Manifests.read("Rultor-EC2Type"),
Manifests.read("Rultor-EC2Group"),
Manifests.read("Rultor-EC2Subnet")
Env.read("Rultor-EC2Image"),
Env.read("Rultor-EC2Type"),
Env.read("Rultor-EC2Group"),
Env.read("Rultor-EC2Subnet")
),
false
)
Expand Down Expand Up @@ -340,10 +340,10 @@ public Agent agent(final Talk talk, final Profile profile)
new Tweets(
this.github,
new OAuthTwitter(
Manifests.read("Rultor-TwitterKey"),
Manifests.read("Rultor-TwitterSecret"),
Manifests.read("Rultor-TwitterToken"),
Manifests.read("Rultor-TwitterTokenSecret")
Env.read("Rultor-TwitterKey"),
Env.read("Rultor-TwitterSecret"),
Env.read("Rultor-TwitterToken"),
Env.read("Rultor-TwitterTokenSecret")
)
)
),
Expand All @@ -361,10 +361,10 @@ public Agent agent(final Talk talk, final Profile profile)
new ArchivesDaemon(
new ReRegion(
new Region.Simple(
Manifests.read("Rultor-S3Key"),
Manifests.read("Rultor-S3Secret")
Env.read("Rultor-S3Key"),
Env.read("Rultor-S3Secret")
)
).bucket(Manifests.read("Rultor-S3Bucket"))
).bucket(Env.read("Rultor-S3Bucket"))
)
),
new Publishes(profile, this.github),
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/rultor/agents/daemons/StartsDaemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
import com.jcabi.aspects.Timeable;
import com.jcabi.immutable.Array;
import com.jcabi.log.Logger;
import com.jcabi.manifests.Manifests;
import com.jcabi.ssh.Shell;
import com.jcabi.ssh.Ssh;
import com.jcabi.xml.XML;
import com.rultor.Env;
import com.rultor.Time;
import com.rultor.agents.Required;
import com.rultor.agents.shells.TalkShells;
Expand Down Expand Up @@ -162,8 +162,8 @@ public String run(final XML xml) throws IOException {
Ssh.escape(
String.format(
"%s %s",
Manifests.read("Rultor-Version"),
Manifests.read("Rultor-Revision")
Env.read("Rultor-Version"),
Env.read("Rultor-Revision")
)
)
),
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/rultor/agents/daemons/Tail.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@

import com.jcabi.aspects.Immutable;
import com.jcabi.log.Logger;
import com.jcabi.manifests.Manifests;
import com.jcabi.s3.Bucket;
import com.jcabi.s3.Region;
import com.jcabi.s3.retry.ReRegion;
import com.jcabi.ssh.Shell;
import com.jcabi.ssh.Ssh;
import com.jcabi.xml.XML;
import com.rultor.Env;
import com.rultor.agents.shells.TalkShells;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -121,9 +121,9 @@ public InputStream read() throws IOException {
new Joined(
"",
"rultor.com ",
Manifests.read("Rultor-Version"),
Env.read("Rultor-Version"),
"/",
Manifests.read("Rultor-Version"),
Env.read("Rultor-Version"),
"\n",
"nothing yet, try again in 15 seconds"
),
Expand Down Expand Up @@ -208,10 +208,10 @@ public InputStream read() throws IOException {
private static Bucket bucket() {
return new ReRegion(
new Region.Simple(
Manifests.read("Rultor-S3Key"),
Manifests.read("Rultor-S3Secret")
Env.read("Rultor-S3Key"),
Env.read("Rultor-S3Secret")
)
).bucket(Manifests.read("Rultor-S3Bucket"));
).bucket(Env.read("Rultor-S3Bucket"));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rultor/agents/github/CommentsTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import com.jcabi.github.Repo;
import com.jcabi.github.Smarts;
import com.jcabi.log.Logger;
import com.jcabi.manifests.Manifests;
import com.jcabi.xml.XML;
import com.rultor.Env;
import com.rultor.agents.AbstractAgent;
import com.rultor.agents.daemons.Home;
import com.rultor.spi.Profile;
Expand Down Expand Up @@ -141,7 +141,7 @@ public Iterable<Directive> process(final XML xml) throws IOException {
"See #%d, release log:\n\n%s\n\nReleased by Rultor %s, see [build log](%s)",
issue.number(),
new CommitsLog(repo).build(prev, rel.publishedAt()),
Manifests.read("Rultor-Version"), home
Env.read("Rultor-Version"), home
)
);
Logger.info(this, "tag %s created and commented", tag);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/rultor/agents/github/qtn/QnVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.github.Comment;
import com.jcabi.log.Logger;
import com.jcabi.manifests.Manifests;
import com.rultor.Env;
import com.rultor.agents.github.Answer;
import com.rultor.agents.github.Question;
import com.rultor.agents.github.Req;
Expand Down Expand Up @@ -65,8 +65,8 @@ public Req understand(final Comment.Smart comment,
true,
String.format(
QnVersion.PHRASES.getString("QnVersion.intro"),
Manifests.read("Rultor-Version"),
Manifests.read("Rultor-Revision")
Env.read("Rultor-Version"),
Env.read("Rultor-Revision")
)
);
Logger.info(this, "version request in #%d", comment.issue().number());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/rultor/agents/req/Decrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
package com.rultor.agents.req;

import com.jcabi.aspects.Immutable;
import com.jcabi.manifests.Manifests;
import com.jcabi.ssh.Ssh;
import com.jcabi.xml.XML;
import com.rultor.Env;
import com.rultor.agents.daemons.StartsDaemon;
import com.rultor.spi.Profile;
import java.io.IOException;
Expand Down Expand Up @@ -109,7 +109,7 @@ public Iterable<String> commands() throws IOException {
this.proxy,
String.format(
"--verbose --recv-keys %s",
Manifests.read("Rultor-GpgPublic")
Env.read("Rultor-GpgPublic")
)
)
);
Expand Down Expand Up @@ -168,7 +168,7 @@ public Iterable<String> commands() throws IOException {
commands.add(
String.format(
"gpg --batch --yes --delete-secret-keys %s",
Manifests.read("Rultor-GpgSecret")
Env.read("Rultor-GpgSecret")
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rultor/profiles/Profiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import com.jcabi.github.Repo;
import com.jcabi.github.RtGithub;
import com.jcabi.github.wire.RetryCarefulWire;
import com.jcabi.manifests.Manifests;
import com.jcabi.xml.XML;
import com.rultor.Env;
import com.rultor.agents.github.TalkIssues;
import com.rultor.agents.github.qtn.DefaultBranch;
import com.rultor.spi.Profile;
Expand Down Expand Up @@ -199,7 +199,7 @@ private Profile fetch(final XML xml) throws IOException {
private static Github github() {
return new RtGithub(
new RtGithub(
Manifests.read("Rultor-GithubToken")
Env.read("Rultor-GithubToken")
).entry().through(
RetryCarefulWire.class,
100
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/rultor/web/RsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
package com.rultor.web;

import com.jcabi.manifests.Manifests;
import com.rultor.Env;
import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
Expand Down Expand Up @@ -101,13 +101,13 @@ private static Response make(final String xsl, final Request req,
new XeLocalhost(),
new XeIdentity(req),
new XeFlash(req),
new XeGithubLink(req, Manifests.read("Rultor-GithubId")),
new XeGithubLink(req, Env.read("Rultor-GithubId")),
new XeLogoutLink(req),
new XeAppend(
"version",
new XeAppend("name", Manifests.read("Rultor-Version")),
new XeAppend("revision", Manifests.read("Rultor-Revision")),
new XeAppend("date", Manifests.read("Rultor-Date"))
new XeAppend("name", Env.read("Rultor-Version")),
new XeAppend("revision", Env.read("Rultor-Revision")),
new XeAppend("date", Env.read("Rultor-Date"))
)
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rultor/web/TkApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
package com.rultor.web;

import com.jcabi.manifests.Manifests;
import com.rultor.Env;
import com.rultor.Toggles;
import com.rultor.spi.Pulse;
import com.rultor.spi.Talks;
Expand Down Expand Up @@ -58,7 +58,7 @@ public final class TkApp extends TkWrap {
/**
* Revision of rultor.
*/
private static final String REV = Manifests.read("Rultor-Revision");
private static final String REV = Env.read("Rultor-Revision");

/**
* Ctor.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/rultor/web/TkAppAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
package com.rultor.web;

import com.jcabi.manifests.Manifests;
import com.rultor.Env;
import java.util.regex.Pattern;
import org.takes.Take;
import org.takes.facets.auth.PsByFlag;
Expand Down Expand Up @@ -82,14 +82,14 @@ private static Take make(final Take take) {
),
new PsChain(
new PsFake(
Manifests.read("Rultor-DynamoKey").startsWith("AAAA")
Env.read("Rultor-DynamoKey").startsWith("AAAA")
),
new PsByFlag(
new PsByFlag.Pair(
PsGithub.class.getSimpleName(),
new PsGithub(
Manifests.read("Rultor-GithubId"),
Manifests.read("Rultor-GithubSecret")
Env.read("Rultor-GithubId"),
Env.read("Rultor-GithubSecret")
)
),
new PsByFlag.Pair(
Expand All @@ -102,7 +102,7 @@ private static Take make(final Take take) {
new CcHex(
new CcXor(
new CcSalted(new CcCompact()),
Manifests.read("Rultor-SecurityKey")
Env.read("Rultor-SecurityKey")
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rultor/web/TkAppFallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
package com.rultor.web;

import com.jcabi.log.Logger;
import com.jcabi.manifests.Manifests;
import com.rultor.Env;
import io.sentry.Sentry;
import java.io.IOException;
import java.net.HttpURLConnection;
Expand All @@ -57,7 +57,7 @@ final class TkAppFallback extends TkWrap {
/**
* Revision of rultor.
*/
private static final String REV = Manifests.read("Rultor-Revision");
private static final String REV = Env.read("Rultor-Revision");

/**
* Ctor.
Expand Down
Loading

0 comments on commit ce7e085

Please sign in to comment.