Skip to content

Commit

Permalink
feat(api): create platform dependant default values for CLI flags (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
deviantony committed Jan 4, 2017
1 parent 59f1a2f commit d8b800d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api/cli/cli.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
Endpoint: kingpin.Flag("host", "Dockerd endpoint").Short('H').String(), Endpoint: kingpin.Flag("host", "Dockerd endpoint").Short('H').String(),
Logo: kingpin.Flag("logo", "URL for the logo displayed in the UI").String(), Logo: kingpin.Flag("logo", "URL for the logo displayed in the UI").String(),
Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')), Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')),
Addr: kingpin.Flag("bind", "Address and port to serve Portainer").Default(":9000").Short('p').String(), Addr: kingpin.Flag("bind", "Address and port to serve Portainer").Default(defaultBindAddress).Short('p').String(),
Assets: kingpin.Flag("assets", "Path to the assets").Default(".").Short('a').String(), Assets: kingpin.Flag("assets", "Path to the assets").Default(defaultAssetsDirectory).Short('a').String(),
Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default("/data").Short('d').String(), Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default(defaultDataDirectory).Short('d').String(),
Templates: kingpin.Flag("templates", "URL to the templates (apps) definitions").Default("https://raw.githubusercontent.com/portainer/templates/master/templates.json").Short('t').String(), Templates: kingpin.Flag("templates", "URL to the templates (apps) definitions").Default(defaultTemplatesURL).Short('t').String(),
TLSVerify: kingpin.Flag("tlsverify", "TLS support").Default("false").Bool(), TLSVerify: kingpin.Flag("tlsverify", "TLS support").Default(defaultTLSVerify).Bool(),
TLSCacert: kingpin.Flag("tlscacert", "Path to the CA").Default("/certs/ca.pem").String(), TLSCacert: kingpin.Flag("tlscacert", "Path to the CA").Default(defaultTLSCACertPath).String(),
TLSCert: kingpin.Flag("tlscert", "Path to the TLS certificate file").Default("/certs/cert.pem").String(), TLSCert: kingpin.Flag("tlscert", "Path to the TLS certificate file").Default(defaultTLSCertPath).String(),
TLSKey: kingpin.Flag("tlskey", "Path to the TLS key").Default("/certs/key.pem").String(), TLSKey: kingpin.Flag("tlskey", "Path to the TLS key").Default(defaultTLSKeyPath).String(),
} }


kingpin.Parse() kingpin.Parse()
Expand Down
14 changes: 14 additions & 0 deletions api/cli/defaults.go
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build !windows

package cli

const (
defaultBindAddress = ":9000"
defaultDataDirectory = "/data"
defaultAssetsDirectory = "."
defaultTemplatesURL = "https://raw.githubusercontent.com/portainer/templates/master/templates.json"
defaultTLSVerify = "false"
defaultTLSCACertPath = "/certs/ca.pem"
defaultTLSCertPath = "/certs/cert.pem"
defaultTLSKeyPath = "/certs/key.pem"
)
12 changes: 12 additions & 0 deletions api/cli/defaults_windows.go
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,12 @@
package cli

const (
defaultBindAddress = ":9000"
defaultDataDirectory = "C:\\data"
defaultAssetsDirectory = "."
defaultTemplatesURL = "https://raw.githubusercontent.com/portainer/templates/master/templates.json"
defaultTLSVerify = "false"
defaultTLSCACertPath = "C:\\certs\\ca.pem"
defaultTLSCertPath = "C:\\certs\\cert.pem"
defaultTLSKeyPath = "C:\\certs\\key.pem"
)
2 changes: 2 additions & 0 deletions build/windows/microsoftservercore/Dockerfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM microsoft/windowsservercore


COPY dist / COPY dist /


VOLUME C:\\data

WORKDIR / WORKDIR /


EXPOSE 9000 EXPOSE 9000
Expand Down
2 changes: 2 additions & 0 deletions build/windows/nanoserver/Dockerfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM microsoft/nanoserver


COPY dist / COPY dist /


VOLUME C:\\data

WORKDIR / WORKDIR /


EXPOSE 9000 EXPOSE 9000
Expand Down

0 comments on commit d8b800d

Please sign in to comment.