added cache
This commit is contained in:
@ -16,12 +16,10 @@ limitations under the License.
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dalu/chromedom/server"
|
||||
"github.com/spf13/cobra"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
// serveCmd represents the serve command
|
||||
@ -32,13 +30,15 @@ var serveCmd = &cobra.Command{
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
binary := cmd.Flag("binary").Value.String()
|
||||
s := http.DefaultServeMux
|
||||
h := server.NewHandler(binary)
|
||||
h := server.NewHandler(binary, 30*time.Minute)
|
||||
s.Handle("/", h)
|
||||
return http.ListenAndServe(":9292", s)
|
||||
// return RunUnix("/tmp/chromedom.sock", s)
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
func RunUnix(file string, engine *http.ServeMux) (err error) {
|
||||
fmt.Printf("Listening and serving HTTP on unix:/%s", file)
|
||||
os.Remove(file)
|
||||
@ -51,6 +51,7 @@ func RunUnix(file string, engine *http.ServeMux) (err error) {
|
||||
err = http.Serve(listener, engine)
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(serveCmd)
|
||||
|
Reference in New Issue
Block a user