summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-02-25 18:58:55 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-02-25 18:58:55 +0800
commit9c3a8ff2994a34ff28484650aa400a0b167855f3 (patch)
treee96ca450d6e1f566c054d2dd6db2dd268d709243 /models
parent52984f85d5afc2a74bb3ca04487da7fb277437d6 (diff)
downloadgitea-9c3a8ff2994a34ff28484650aa400a0b167855f3.tar.gz
gitea-9c3a8ff2994a34ff28484650aa400a0b167855f3.zip
add run user
Diffstat (limited to 'models')
-rw-r--r--models/publickey.go19
-rw-r--r--models/user.go2
2 files changed, 16 insertions, 5 deletions
diff --git a/models/publickey.go b/models/publickey.go
index 2fd1895d6c..86dd50e849 100644
--- a/models/publickey.go
+++ b/models/publickey.go
@@ -4,15 +4,16 @@ import (
"fmt"
"os"
"os/exec"
+ "os/user"
"path/filepath"
"time"
)
var (
- publicKeyRootPath string
- sshPath string = "/Users/lunny/.ssh"
- appPath string
- tmplPublicKey = "### autogenerated by gitgos, DO NOT EDIT\n" +
+ //publicKeyRootPath string
+ sshPath string
+ appPath string
+ tmplPublicKey = "### autogenerated by gitgos, DO NOT EDIT\n" +
"command=\"%s serv key-%d\",no-port-forwarding," +
"no-X11-forwarding,no-agent-forwarding,no-pty %s\n"
)
@@ -25,6 +26,14 @@ func exePath() (string, error) {
return filepath.Abs(file)
}
+func homeDir() string {
+ user, err := user.Current()
+ if err != nil {
+ return "/"
+ }
+ return user.HomeDir
+}
+
func init() {
var err error
appPath, err = exePath()
@@ -32,6 +41,8 @@ func init() {
println(err.Error())
os.Exit(2)
}
+
+ sshPath = filepath.Join(homeDir(), ".ssh")
}
type PublicKey struct {
diff --git a/models/user.go b/models/user.go
index c5208f0313..086b02c82f 100644
--- a/models/user.go
+++ b/models/user.go
@@ -66,7 +66,7 @@ const (
OP_PULL_REQUEST
)
-// A Action represents
+// An Action represents
type Action struct {
Id int64
UserId int64