Documentation
¶
Overview ¶
Copyright 2019 SpotHero
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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string // Name of the application
Environment string // Environment where the server is running
Version string // Semantic Version of the application
GitSHA string // GitSHA of the application when compiled
Registry prometheus.Registerer // The Prometheus Registry to use. If nil, the global registry is used by default.
}
Config defines service level configuration for HTTP servers
func (Config) CheckFlags ¶
CheckFlags ensures that the Service Config contains all necessary configuration for use at runtime. An error is returned describing any missing fields.
func (*Config) RegisterFlags ¶
RegisterFlags registers Service flags with pflags
type HTTPConfig ¶
func (HTTPConfig) ServerCmd ¶
func (hc HTTPConfig) ServerCmd() *cobra.Command
ServerCmd creates and returns a Cobra and Viper command preconfigured to run a production-quality HTTP server. Note that this function returns the Default HTTP server for use at SpotHero. Consumers of the tools libraries are free to define their own server entrypoints if desired. This function is provided as a convenience function that should satisfy most use cases Note that Version and GitSHA *must be specified* before calling this function.