github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/src/wakeup/config/config.go (about) 1 // Copyright (c) 2015 Cameron King. All rights reserved. 2 // License: BSD 2-clause. 3 // Website: https://github.com/ckxng/wakeup 4 5 package config 6 7 import ( 8 "fmt" 9 ) 10 11 type Config struct { 12 Host string 13 Port int 14 EnableServer bool 15 EnableWindow bool 16 Path string 17 Protocol string 18 CachePath string 19 Title string 20 WindowX int32 21 WindowY int32 22 WindowWidth int32 23 WindowHeight int32 24 } 25 26 func NewConfig() (*Config) { 27 return &Config{ 28 Host: "127.0.0.1", 29 Port: 3000, 30 EnableServer: true, 31 EnableWindow: true, 32 Path: "/", 33 Protocol: "http", 34 CachePath: "webcache", 35 Title: "Application", 36 WindowX: 0, 37 WindowY: 0, 38 WindowWidth: 320, 39 WindowHeight: 240, 40 } 41 } 42 43 func (cfg *Config) URL() (string) { 44 return fmt.Sprintf( 45 "%s://%s:%d%s", 46 cfg.Protocol, 47 cfg.Host, 48 cfg.Port, 49 cfg.Path) 50 }