Разделить среды и закрепить лицензии в HEADER 1.0

This commit is contained in:
AidarKC
2026-12-05 11:42:20 +03:00
parent a64168a748
commit 77c7021aed
89 changed files with 4204 additions and 211 deletions
+18
View File
@@ -0,0 +1,18 @@
import blockchain.*;
import utils.config.ServerEnvironment;
import java.nio.file.*;
import java.util.HexFormat;
import java.util.List;
public class ServerEnvironmentCheck {
public static void main(String[] args) throws Exception {
boolean test = Boolean.parseBoolean(args[0]);
if (ServerEnvironment.TEST_MODE != test || !ServerEnvironment.ARWEAVE_APP_TAG.equals(test ? "test5570" : "SHiNE") || !ServerEnvironment.SOLANA_CLUSTER.equals(test ? "devnet" : "mainnet-beta")) throw new AssertionError("wrong environment");
for (String x : new String[]{null,"true","False","invalid",""}) if (!ServerEnvironment.isTestMode(x)) throw new AssertionError("unsafe default");
if (ServerEnvironment.isTestMode("false")) throw new AssertionError("explicit production ignored");
var row = Files.readAllLines(Path.of(args[1])).get(1).split("\t");
var item = new Ans104DataItem(HexFormat.of().parseHex(row[6]));
try { CoreContentTransport.requireApp(item); if (!test) throw new AssertionError("test CORE accepted in production"); }
catch (CoreContentTransport.WrongAppNamespace e) { if (test) throw e; }
System.out.println("PASS environment=" + ServerEnvironment.ARWEAVE_APP_TAG + ", cluster=" + ServerEnvironment.SOLANA_CLUSTER);
}
}