Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/usage/stripe.go
2501 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
/// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package usage
6
7
import (
8
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
9
corev1 "k8s.io/api/core/v1"
10
"path/filepath"
11
)
12
13
func getStripeConfig(cfg *experimental.Config) (corev1.Volume, corev1.VolumeMount, string, bool) {
14
var volume corev1.Volume
15
var mount corev1.VolumeMount
16
var path string
17
18
if cfg == nil || cfg.WebApp == nil || cfg.WebApp.Server == nil || cfg.WebApp.Server.StripeSecret == "" {
19
return volume, mount, path, false
20
}
21
22
stripeSecret := cfg.WebApp.Server.StripeSecret
23
24
volume = corev1.Volume{
25
Name: "stripe-secret",
26
VolumeSource: corev1.VolumeSource{
27
Secret: &corev1.SecretVolumeSource{
28
SecretName: stripeSecret,
29
},
30
},
31
}
32
33
mount = corev1.VolumeMount{
34
Name: "stripe-secret",
35
MountPath: stripeSecretMountPath,
36
ReadOnly: true,
37
}
38
39
path = filepath.Join(stripeSecretMountPath, stripeKeyFilename)
40
41
return volume, mount, path, true
42
}
43
44