From b3913750086047c235e7bdd6dd16f3377b3c0360 Mon Sep 17 00:00:00 2001 From: lealife Date: Thu, 14 May 2015 19:23:56 +0800 Subject: [PATCH] =?UTF-8?q?font-awesome.css=E6=89=BE=E4=B8=8D=E5=88=B0=20#?= =?UTF-8?q?140?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/ConfigService.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/service/ConfigService.go b/app/service/ConfigService.go index 9144ec2..b478d5c 100644 --- a/app/service/ConfigService.go +++ b/app/service/ConfigService.go @@ -455,12 +455,15 @@ var port string func init() { revel.OnAppStart(func() { + /* + 不用配置的, 因为最终通过命令可以改, 而且有的使用nginx代理 port = strconv.Itoa(revel.HttpPort) if port != "80" { port = ":" + port } else { port = ""; } + */ siteUrl, _ := revel.Config.String("site.url") // 已包含:9000, http, 去掉成 leanote.com if strings.HasPrefix(siteUrl, "http://") { @@ -469,6 +472,17 @@ func init() { defaultDomain = siteUrl[len("https://"):] schema = "https://" } + + // port localhost:9000 + ports := strings.Split(defaultDomain, ":") + if len(ports) == 2 { + port = ports[1] + } + if port == "80" { + port = "" + } else { + port = ":" + port + } }) }