add some works
This commit is contained in:
parent
cd9ec0c774
commit
8807e5aaab
22 changed files with 1074 additions and 3 deletions
7
app/account.go
Normal file
7
app/account.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package app
|
||||
|
||||
type SSHKey struct {
|
||||
ID string `json:"id"`
|
||||
Private []byte `json:"prv,omitempty"`
|
||||
Public []byte `json:"pub,omitempty"`
|
||||
}
|
46
app/app.go
Normal file
46
app/app.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
const (
|
||||
serverName = "Sub Hub"
|
||||
softwareVer = "0.0.1"
|
||||
configFile = "config.json"
|
||||
)
|
||||
|
||||
type app struct {
|
||||
db *sql.DB
|
||||
cfg *config
|
||||
}
|
||||
|
||||
type config struct {
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
MySQLConnStr string `json:"mysql_conn_str"`
|
||||
Name string `json:"instance_name"`
|
||||
}
|
||||
|
||||
func Serve() {
|
||||
app := &app{
|
||||
cfg: &config{},
|
||||
}
|
||||
|
||||
var newUser, newPass string
|
||||
flag.IntVar(&app.cfg.Port, "p", 8090, "Port to start server on")
|
||||
flag.StringVar(&app.cfg.Host, "h", "", "Serer base URL")
|
||||
|
||||
// options for creating a new user
|
||||
flag.StringVar(&newUser, "user", "", "New user's username. Should be paired with --pass")
|
||||
flag.StringVar(&newPass, "pass", "", "Password for new user. Should be paired with --user")
|
||||
flag.Parse()
|
||||
|
||||
if app.cfg.Host == "" || os.Getenv("SH_MYSQL_CONNECTION") == "" {
|
||||
log.Printf("Reding %s", configFile)
|
||||
//f, err := ioutil.ReadFile(configFile)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue