This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #900: Removes '0' from the list of valid ports the REST API can…
… be started on; also refactors how command-line flags are set and prints valid defaults where applicable
- Loading branch information
Tom McSweeney
committed
Jun 7, 2016
1 parent
4b8ee45
commit 4f7afa7
Showing
6 changed files
with
135 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Copyright 2015 Intel Corporation | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package control | ||
|
||
import "github.com/codegangsta/cli" | ||
|
||
var ( | ||
flNumberOfPLs = cli.IntFlag{ | ||
Name: "max-running-plugins, m", | ||
Value: defaultMaxRunningPlugins, | ||
Usage: "The maximum number of instances of a loaded plugin to run", | ||
EnvVar: "SNAP_MAX_PLUGINS", | ||
} | ||
flPluginTrust = cli.IntFlag{ | ||
Name: "plugin-trust, t", | ||
Usage: "0-2 (Disabled, Enabled, Warning)", | ||
Value: defaultPluginTrust, | ||
EnvVar: "SNAP_TRUST_LEVEL", | ||
} | ||
flAutoDiscover = cli.StringFlag{ | ||
Name: "auto-discover, a", | ||
Usage: "Auto discover paths separated by colons.", | ||
EnvVar: "SNAP_AUTODISCOVER_PATH", | ||
} | ||
flKeyringPaths = cli.StringFlag{ | ||
Name: "keyring-paths, k", | ||
Usage: "Keyring paths for signing verification separated by colons", | ||
EnvVar: "SNAP_KEYRING_PATHS", | ||
} | ||
flCache = cli.DurationFlag{ | ||
Name: "cache-expiration", | ||
Usage: "The time limit for which a metric cache entry is valid", | ||
Value: defaultCacheExpiration, | ||
EnvVar: "SNAP_CACHE_EXPIRATION", | ||
} | ||
|
||
// Flags consumed by snapd | ||
Flags = []cli.Flag{flNumberOfPLs, flPluginTrust, flAutoDiscover, flKeyringPaths, flCache} | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Copyright 2015 Intel Corporation | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package rest | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/codegangsta/cli" | ||
) | ||
|
||
var ( | ||
flAPIDisabled = cli.BoolFlag{ | ||
Name: "disable-api, d", | ||
Usage: "Disable the agent REST API", | ||
} | ||
flAPIAddr = cli.StringFlag{ | ||
Name: "api-addr, b", | ||
Usage: "API Address[:port] to bind to/listen on. Default: empty string => listen on all interfaces", | ||
EnvVar: "SNAP_ADDR", | ||
} | ||
flAPIPort = cli.IntFlag{ | ||
Name: "api-port, p", | ||
Usage: fmt.Sprintf("API port (Default: %d)", defaultPort), | ||
Value: defaultPort, | ||
EnvVar: "SNAP_PORT", | ||
} | ||
flRestHTTPS = cli.BoolFlag{ | ||
Name: "rest-https", | ||
Usage: "start snap's API as https", | ||
} | ||
flRestCert = cli.StringFlag{ | ||
Name: "rest-cert", | ||
Usage: "A path to a certificate to use for HTTPS deployment of snap's REST API", | ||
} | ||
flRestKey = cli.StringFlag{ | ||
Name: "rest-key", | ||
Usage: "A path to a key file to use for HTTPS deployment of snap's REST API", | ||
} | ||
flRestAuth = cli.BoolFlag{ | ||
Name: "rest-auth", | ||
Usage: "Enables snap's REST API authentication", | ||
} | ||
|
||
// Flags consumed by snapd | ||
Flags = []cli.Flag{flAPIDisabled, flAPIAddr, flAPIPort, flRestHTTPS, flRestCert, flRestKey, flRestAuth} | ||
) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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