Skip to content

Commit

Permalink
Load config from environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Lei committed Aug 26, 2016
1 parent b8eb05b commit d3f466b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/server/skyconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ type Configuration struct {
SecretToken string `json:"secret_key"`
Region string `json:"region"`
Bucket string `json:"bucket"`

// followings only used when ImplName = cloud
CloudAssetHost string `json:"cloud_asset_host"`
CloudAssetToken string `json:"cloud_asset_token"`
CloudAssetPublicPrefix string `json:"cloud_asset_public_prefix"`
CloudAssetPrivatePrefix string `json:"cloud_asset_private_prefix"`
} `json:"asset_store"`
AssetURLSigner struct {
URLPrefix string `json:"url_prefix"`
Expand Down Expand Up @@ -296,6 +302,24 @@ func (config *Configuration) readAssetStore() {
if assetStoreBucket != "" {
config.AssetStore.Bucket = assetStoreBucket
}

// Cloud Asset related
cloudAssetHost := os.Getenv("CLOUD_ASSET_HOST")
if cloudAssetHost != "" {
config.AssetStore.CloudAssetHost = cloudAssetHost
}
cloudAssetToken := os.Getenv("CLOUD_ASSET_TOKEN")
if cloudAssetToken != "" {
config.AssetStore.CloudAssetToken = cloudAssetToken
}
cloudAssetPublicPrefix := os.Getenv("CLOUD_ASSET_PUBLIC_PREFIX")
if cloudAssetPublicPrefix != "" {
config.AssetStore.CloudAssetPublicPrefix = cloudAssetPublicPrefix
}
cloudAssetPrivatePrefix := os.Getenv("CLOUD_ASSET_PRIVATE_PREFIX")
if cloudAssetPrivatePrefix != "" {
config.AssetStore.CloudAssetPrivatePrefix = cloudAssetPrivatePrefix
}
}

func (config *Configuration) readAPNS() {
Expand Down

0 comments on commit d3f466b

Please sign in to comment.