Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

godocCircle CI

A Go library for configuration management with JSON files in remote storage.

Install

go get github.com/zencoder/go-remote-config

Supported Storage Providers

  • AWS S3 (Signed URLs)
  • HTTP/HTTPS

Features

  • 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

Future Features

  • More storage provider support
    • Google Cloud Storage
    • Rackspace CloudFiles
  • Default value support
  • Config download retry support
  • Live config reloading

Example

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)}

Development

Build and run unit tests

make test

CI

This library builds on Circle CI, here.

License

Apache License Version 2.0

About

A Go library for configuration management with JSON files in remote storage.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors17


[8]ページ先頭

©2009-2025 Movatter.jp