Add TO Golang Postinstall setting ports

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9b9b3fb4
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9b9b3fb4
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9b9b3fb4

Branch: refs/heads/master
Commit: 9b9b3fb4107700c2bf90c2ba841e859908073124
Parents: a54b0ef
Author: Robert Butts <robert.o.bu...@gmail.com>
Authored: Fri Jul 21 19:33:23 2017 -0600
Committer: Dewayne Richardson <dewr...@apache.org>
Committed: Thu Aug 10 09:46:03 2017 -0600

----------------------------------------------------------------------
 traffic_ops/install/bin/_postinstall | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9b9b3fb4/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall 
b/traffic_ops/install/bin/_postinstall
index c595ab4..b83e65a 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -183,6 +183,18 @@ sub generateDbConf {
     return \%todbconf;
 }
 
+sub setCdnConfGoPort {
+    my $cdnConf = shift;
+    if ( exists $cdnConf->{"traffic_ops_golang_port"} ) {
+        return $cdnConf;
+    }
+    my ($port) = $cdnConf->{hypnotoad}->{listen}[0] =~ m/\:(\d+)/;
+    $cdnConf->{hypnotoad}->{listen}[0] =~ s/\:\d+/\:60443/;
+    $cdnConf->{hypnotoad}->{listen}[0] =~ 
s/https\:\/\/[\:\:]/https\:\/\/127\.0\.0\.1/;
+    $cdnConf->{"traffic_ops_golang_port"} = $port;
+    return $cdnConf;
+}
+
 # userInput: The entire input config file which is either user input or the 
defaults
 # fileName: The filename of the output config file
 #
@@ -218,6 +230,7 @@ sub generateCdnConf {
             $#secrets = $cdnConfiguration{keepSecrets} - 1;
         }
     }
+    $cdnConf = setCdnConfGoPort($cdnConf);
     $cdnConf->{hypnotoad}{workers} = $cdnConfiguration{workers};
     InstallUtils::writePerl( $fileName, $cdnConf );
     InstallUtils::logger( "CDN configuration has been saved", "info" );

Reply via email to