Skip to content

Commit

Permalink
Add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
blp1526 committed Jul 9, 2017
1 parent d1c9b09 commit 559c702
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# scv

SAKURA Cloud VNC Opener for MacOS

## Installation

Download a binary from [here](https://github.com/blp1526/scv/releases).

## Usage


1. Create a config file at `$HOME/scv.json`.

1. Write a config file refering to [`scv.sample.json`](scv.sample.json).

1. Run below command.

```
# format
$ scv ZONE_NAME SERVER_NAME
# example
$ scv tk1a centos7
```
4 changes: 2 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Request(body interface{}, zoneName string, serverName string) error {
serverId = scv.Servers[i].ID
}
}
logger.Debug(fmt.Sprintf("Found ServerID is %s", serverId))
logger.Debug(fmt.Sprintf("Server ID: %s", serverId))

if serverId == "" {
return errors.New(fmt.Sprintf("ServerID is not found by ZoneName %s and ServerName %s", zoneName, serverName))
Expand All @@ -47,7 +47,7 @@ func Request(body interface{}, zoneName string, serverName string) error {
host := "secure.sakura.ad.jp"
path := "/cloud/zone/" + zoneName + "/api/cloud/1.1/server/" + serverId + "/vnc/proxy"
url := scheme + "://" + host + path
logger.Debug("URL is " + url)
logger.Debug(fmt.Sprintf("URL: %s", url))

req, err := http.NewRequest("GET", url, nil)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"os/exec"

"github.com/blp1526/scv/api"
Expand All @@ -15,7 +16,7 @@ func Run(zoneName string, serverName string) error {
}

vncPath := vncPath(*body)
logger.Debug("vncPath is " + vncPath)
logger.Debug(fmt.Sprintf("VNC Path: %s", vncPath))
err = exec.Command("open", vncPath).Run()
return err
}
Expand Down

0 comments on commit 559c702

Please sign in to comment.