Skip to content

Commit

Permalink
Add externalRepository
Browse files Browse the repository at this point in the history
Use instead of externalBlazor in registry descriptors
Set by AASREPOSITORY variable
  • Loading branch information
aorzelskiGH committed Jun 5, 2024
1 parent 73ad510 commit 869fb93
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/AasxServerStandardBib/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ public static bool loadPackageForSubmodel(string submodelIdentifier, out ISubmod
public static bool edit = false;
public static string externalRest = "";
public static string externalBlazor = "";
public static string externalRepository = "";
public static bool readTemp = false;
public static int saveTemp = 0;
public static DateTime saveTempDt = new DateTime();
Expand Down Expand Up @@ -734,7 +735,7 @@ private static async Task<int> Run(CommandLineArguments a)
}

// Read environment variables
string[] evlist = { "PLCNEXTTARGET", "WITHPOLICY", "SHOWWEIGHT" };
string[] evlist = { "PLCNEXTTARGET", "WITHPOLICY", "SHOWWEIGHT", "AASREPOSITORY" };
foreach (var ev in evlist)
{
string v = System.Environment.GetEnvironmentVariable(ev);
Expand Down Expand Up @@ -771,6 +772,7 @@ private static async Task<int> Run(CommandLineArguments a)
}
Console.WriteLine("showWeight: " + showWeight);
}
envVariables.TryGetValue("AASREPOSITORY", out externalRepository);

if (a.Connect != null)
{
Expand Down Expand Up @@ -944,6 +946,8 @@ private static async Task<int> Run(CommandLineArguments a)
}
externalBlazor = externalBlazor.Replace("\r", "");
externalBlazor = externalBlazor.Replace("\n", "");
if (externalRepository == "")
externalRepository = externalBlazor;

/*
if (File.Exists("redirect.dat"))
Expand Down
4 changes: 2 additions & 2 deletions src/IO.Swagger.Registry.Lib.V3/Services/AasRegistryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public AssetAdministrationShellDescriptor CreateAasDescriptorFromDB(AasSet aasDB
var e = new Models.Endpoint();
e.ProtocolInformation = new ProtocolInformation();
e.ProtocolInformation.Href =
AasxServer.Program.externalBlazor + "/shells/" +
AasxServer.Program.externalRepository + "/shells/" +
Base64UrlEncoder.Encode(ad.Id);
_logger.LogDebug("AAS " + ad.IdShort + " " + e.ProtocolInformation.Href);
e.Interface = "AAS-1.0";
Expand All @@ -65,7 +65,7 @@ public AssetAdministrationShellDescriptor CreateAasDescriptorFromDB(AasSet aasDB
var esm = new Models.Endpoint();
esm.ProtocolInformation = new ProtocolInformation();
esm.ProtocolInformation.Href =
AasxServer.Program.externalBlazor + "/shells/" +
AasxServer.Program.externalRepository + "/shells/" +
Base64UrlEncoder.Encode(ad.Id) + "/submodels/" +
Base64UrlEncoder.Encode(sd.Id);
// Base64UrlEncoder.Encode(sd.Identification) + "/submodel/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ static void AddAasToRegistry(AdminShellNS.AdminShellPackageEnv env, DateTime tim
var e = new Endpoint();
e.ProtocolInformation = new ProtocolInformation();
e.ProtocolInformation.Href =
Program.externalBlazor + "/shells/" +
Program.externalRepository + "/shells/" +
Base64UrlEncoder.Encode(ad.Id);
Console.WriteLine("AAS " + ad.IdShort + " " + e.ProtocolInformation.Href);
e.Interface = "AAS-1.0";
Expand Down Expand Up @@ -687,7 +687,7 @@ static void AddAasToRegistry(AdminShellNS.AdminShellPackageEnv env, DateTime tim
var esm = new Models.Endpoint();
esm.ProtocolInformation = new ProtocolInformation();
esm.ProtocolInformation.Href =
AasxServer.Program.externalBlazor + "/shells/" +
AasxServer.Program.externalRepository + "/shells/" +
Base64UrlEncoder.Encode(ad.Id) + "/submodels/" +
Base64UrlEncoder.Encode(sd.Id);
// Console.WriteLine("SM " + sd.IdShort + " " + esm.ProtocolInformation.EndpointAddress);
Expand Down

0 comments on commit 869fb93

Please sign in to comment.