Documentation
¶
Overview ¶
Package config provides the configuration for the application.
Index ¶
Constants ¶
View Source
const ( // PublicAssetGetURLExpiryViperKey is the viper key for the public asset get URL expiry PublicAssetGetURLExpiryViperKey = "api.assets.public-asset-get-url-expiry" // PrivateAssetGetURLExpiryViperKey is the viper key for the private asset get URL expiry PrivateAssetGetURLExpiryViperKey = "api.assets.private-asset-get-url-expiry" // RefreshAssetURLExpiryViperKey is the viper key for the refresh asset URL expiry RefreshAssetURLExpiryViperKey = "api.assets.refresh-asset-url-expiry" // APIListenViperKey is the viper key for the listen address APIListenViperKey = "api.listen" // APIHTTPViperKey is the viper key for the http server APIHTTPViperKey = "api.http" // APIHTTPListenViperKey is the viper key for the http listen address APIHTTPListenViperKey = "api.httplisten" // APITimeoutViperKey is the viper key for the timeout APITimeoutViperKey = "api.timeout" // DefaultPublicAssetGetURLExpiry is the default public asset get URL expiry DefaultPublicAssetGetURLExpiry = 7 * 24 * time.Hour // DefaultPrivateAssetGetURLExpiry is the default private asset get URL expiry DefaultPrivateAssetGetURLExpiry = 1 * time.Hour // DefaultRefreshAssetURLExpiry is the default refresh asset URL expiry DefaultRefreshAssetURLExpiry = 30 * time.Minute )
View Source
const ( // GCPStorageEmulatorViperKey is the viper key for the gcp storage emulator GCPStorageEmulatorViperKey = "gcp.storage.emulator" // GCPStorageBucketNameViperKey is the viper key for the gcp storage bucket name GCPStorageBucketNameViperKey = "gcp.storage.bucket-name" // GCPStorageCORSMaxAgeViperKey is the viper key for the gcp storage CORS max age GCPStorageCORSMaxAgeViperKey = "gcp.storage.cors.max-age" // GCPStorageCORSMethodsViperKey is the viper key for the gcp storage CORS methods GCPStorageCORSMethodsViperKey = "gcp.storage.cors.methods" // GCPStorageCORSOriginsViperKey is the viper key for the gcp storage CORS origins GCPStorageCORSOriginsViperKey = "gcp.storage.cors.origins" // GCPStorageCORSHeadersViperKey is the viper key for the gcp storage CORS headers GCPStorageCORSHeadersViperKey = "gcp.storage.cors.headers" )
View Source
const ( // GCloudServiceAccountViperKey is the viper key for the gcloud service account GCloudServiceAccountViperKey = "gcp.serviceaccount" // GCloudServiceAccountEmailViperKey is the viper key for the gcloud service account email GCloudServiceAccountEmailViperKey = "gcp.serviceaccount-email" // GCloudProjectIDViperKey is the viper key for the gcloud project id GCloudProjectIDViperKey = "gcp.projectid" // GCloudFirestoreEmulatorViperKey is the viper key for the gcloud firestore emulator GCloudFirestoreEmulatorViperKey = "gcp.firestore-emulator" )
Variables ¶
View Source
var ( // ErrMissingGCPProjectID is returned when the GCP project ID is missing ErrMissingGCPProjectID = errors.New("missing GCP project ID") // ErrMissingGCPServiceAccountEmail is returned when the GCP service account email is missing ErrMissingGCPServiceAccountEmail = errors.New("missing GCP service account email") )
Functions ¶
func APIViperFlags ¶
APIViperFlags sets the viper flags for the API
func GCloudViperFlags ¶
GCloudViperFlags adds the gcloud flags to the root command
func StorageViperFlags ¶
StorageViperFlags adds the cloud storage flags to the root command
func ViperFlags ¶
ViperFlags adds the configuration flags to the root command
Types ¶
type API ¶
type API struct { PrivateAssetGetURLExpiry time.Duration PublicAssetGetURLExpiry time.Duration RefreshAssetURLExpiry time.Duration GRPCListen string HTTPListen string HTTP bool Timeout int // contains filtered or unexported fields }
API holds the configuration for the API
type CloudStorage ¶
type CloudStorage struct { Emulator string Bucket string CORS storage.CORS PrivateAssetGetURLExpiry time.Duration PublicAssetGetURLExpiry time.Duration RefreshAssetURLExpiry time.Duration // contains filtered or unexported fields }
CloudStorage holds the configuration for cloud storage
func (*CloudStorage) Configure ¶
func (s *CloudStorage) Configure()
Configure sets the cloud storage configuration
func (*CloudStorage) StorageClient ¶
func (s *CloudStorage) StorageClient( ctx context.Context, app *firebase.App, account string, opts ...cloudstorage.Opt, ) (*cloudstorage.CloudStorage, error)
StorageClient returns a new storage client
type Config ¶
type Config struct { CloudStorage GCloud API // contains filtered or unexported fields }
Config holds the configuration for the application
Click to show internal directories.
Click to hide internal directories.