- Notifications
You must be signed in to change notification settings - Fork4
A Go library for configuration management with JSON files in remote storage.
License
NotificationsYou must be signed in to change notification settings
zencoder/go-remote-config
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Go library for configuration management with JSON files in remote storage.
go get github.com/zencoder/go-remote-config- AWS S3 (Signed URLs)
- HTTP/HTTPS
- Reflection based config validation
- Required fields
- Optional fields
- Custom Validate interface
- Empty string checks
- Struct & Slice, nested support
- Built in config structs for services
- AWS Regions
- AWS DynamoDB (Client + Table)
- AWS SQS (Client + Queue)
- AWS S3
- Generic HTTP Endpoints
- More storage provider support
- Google Cloud Storage
- Rackspace CloudFiles
- Default value support
- Config download retry support
- Live config reloading
typeSampleConfigstruct {SQSQueueOptional*SQSQueueConfig`json:"sqs_queue_optional,omitempty" remoteconfig:"optional"`SQSClientOptional*SQSClientConfig`json:"sqs_client_optional,omitempty" remoteconfig:"optional"`DynamoDBTableOptional*DynamoDBTableConfig`json:"dynamodb_table_optional,omitempty" remoteconfig:"optional"`DynamoDBClientOptional*DynamoDBClientConfig`json:"dynamodb_client_optional,omitempty" remoteconfig:"optional"`StrOptional*string`json:"str_optional,omitempty" remoteconfig:"optional"`StorageConfigOptional*StorageConfig`json:"storage_config_optional,omitempty" remoteconfig:"optional"`StorageConfigSliceOptional []*StorageConfig`json:"storage_config_slice_optional,omitempty" remoteconfig:"optional"`SQSQueue*SQSQueueConfig`json:"sqs_queue,omitempty"`SQSClient*SQSClientConfig`json:"sqs_client,omitempty"`DynamoDBTable*DynamoDBTableConfig`json:"dynamodb_table,omitempty"`DynamoDBClient*DynamoDBClientConfig`json:"dynamodb_client,omitempty"`Str*string`json:"str,omitempty"`StorageConfig*StorageConfig`json:"storage_config,omitempty"`StorageConfigSlice []*StorageConfig`json:"storage_config_slice,omitempty"`}varsSampleConfigLoadConfig(s)import ("log""os""github.com/zencoder/go-remote-config")funcLoadConfig(configinterface{}) {// Load the config from S3configURL:=os.Getenv("S3_CONFIG_URL")configRegion:=remoteconfig.AWSRegion(os.Getenv("S3_CONFIG_REGION"))// Load an endpoint for S3 config (can be used to fake out S3 for testing)configEndpoint:=os.Getenv("S3_CONFIG_ENDPOINT")// We should fail out if config environment variables are not set / validifconfigURL=="" {log.Panic("S3 Configuration URL must be provided.")}iferr:=configRegion.Validate();err!=nil {log.Panic("Invalid Region for S3 Configuration")}log.Printf("Loading config file from S3. URL = %s, Region = %s",configURL,configRegion)iferr:=remoteconfig.LoadConfigFromS3(configURL,configRegion,configEndpoint,config);err!=nil {log.Panicf("Failed to load config file, with error: %s",err.Error())}log.Printf("Successfully loaded config file from S3. URL = %s, Region = %s",configURL,configRegion)log.Printf("%s",config)}
make testAbout
A Go library for configuration management with JSON files in remote storage.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.