-
-
Save cloverstd/a2d7778e667d7cee7c082ae236908109 to your computer and use it in GitHub Desktop.
1Password Anywhere go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"os/user" | |
"fmt" | |
"net/http" | |
go_path "path" | |
) | |
func main() { | |
var port, path string | |
usr, err := user.Current() | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
home_dir := usr.HomeDir | |
one_password_path := go_path.Join(home_dir, "/Dropbox/1Password/1Password.agilekeychain") | |
flag.StringVar(&port, "port", "8000", "the port of http file server") | |
flag.StringVar(&path, "path", one_password_path, "the path of Dropbox 1Password path") | |
flag.Parse() | |
fmt.Printf("Serving HTTP on 0.0.0.0 port %s ...\n1Password located on %s\n", port, path) | |
h := http.FileServer(http.Dir(path)) | |
http.ListenAndServe(":"+port, h) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment