Created
July 17, 2013 19:32
-
-
Save jasonmimick/6023696 to your computer and use it in GitHub Desktop.
Fix up a default HealthShare demo install - run this after ##class(HS.Util.Installer).InstallDemo() - it will set EndPoints to 'localhost' rather than hostname
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
write "fix^FixHSDemoInstall(<newHostValue>)",! | |
write "",! | |
quit | |
updateRegistry(newHost) public { | |
write "["_$namespace_"]updateRegistry('"_newHost_"')",! | |
set rs=##class(%ResultSet).%New() | |
set sc=rs.Prepare("Update HS_Registry_Service.Soap Set Host = ?") | |
if ( 'sc ) { do $system.OBJ.DisplayError(sc) } | |
set sc=rs.Execute(newHost) | |
if ( 'sc ) { do $system.OBJ.DisplayError(sc) } | |
quit | |
} | |
updateConfig(newHost) public { | |
write "["_$namespace_"]updateConfig('"_newHost_"')",! | |
set rs=##class(%ResultSet).%New("HS.Gateway.Config:Extent") | |
set sc=rs.Execute() | |
while ( rs.Next() ) { | |
set id=rs.Get("ID") | |
set config=##class(HS.Gateway.Config).%OpenId(id) | |
if ( config.EndPoint="" ) { | |
continue | |
} | |
write config.EndPoint,! | |
do ##class(%Net.URLParser).Parse(config.EndPoint,.u) | |
set u("host")=newHost | |
set nep=u("scheme")_"://"_u("host")_":"_u("port")_u("path") | |
write nep,! | |
set config.EndPoint=nep | |
set sc=config.%Save() | |
if ( 'sc ) { do $system.OBJ.DisplayError(sc) } | |
} | |
quit | |
} | |
fix() public { | |
set newHost="localhost" | |
write "About to set all service and config endpoints to '"_newHost_"'",! | |
read "Press <Return> to continue or Ctrl^C to abort ",xxx write ! | |
set currentNS=$namespace | |
set namespaces=##class(HS.Util.Installer.Kit.SampleDefinition).GetSystemNamespaces("Registry") | |
for i=1:1:namespaces.Namespace.Count() { | |
set ns=namespaces.Namespace.GetAt(i) | |
//write ns.Name,! | |
if ( '##class(%SYS.Namespace).Exists(ns.Name) ) { | |
continue | |
} | |
zn ns.Name | |
do updateRegistry(newHost) | |
do updateConfig(newHost) | |
} | |
zn currentNS | |
quit | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment