feat: add online payment management and checkout
Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
@@ -11,15 +11,16 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
HTTPAddr string
|
||||
TrustedProxies []string
|
||||
ReadHeaderTimeout time.Duration
|
||||
ReadTimeout time.Duration
|
||||
WriteTimeout time.Duration
|
||||
IdleTimeout time.Duration
|
||||
ShutdownTimeout time.Duration
|
||||
SigningPrivateKeyPEM string
|
||||
CredentialEncryptionKey []byte
|
||||
HTTPAddr string
|
||||
TrustedProxies []string
|
||||
ReadHeaderTimeout time.Duration
|
||||
ReadTimeout time.Duration
|
||||
WriteTimeout time.Duration
|
||||
IdleTimeout time.Duration
|
||||
ShutdownTimeout time.Duration
|
||||
SigningPrivateKeyPEM string
|
||||
CredentialEncryptionKey []byte
|
||||
PaymentConfigEncryptionKey []byte
|
||||
}
|
||||
|
||||
func Load(getenv func(string) string) (Config, error) {
|
||||
@@ -96,6 +97,16 @@ func Load(getenv func(string) string) (Config, error) {
|
||||
}
|
||||
c.CredentialEncryptionKey = data
|
||||
}
|
||||
if path := getenv("PAYMENT_CONFIG_ENCRYPTION_KEY_FILE"); path != "" {
|
||||
if !filepath.IsAbs(path) {
|
||||
return Config{}, fmt.Errorf("PAYMENT_CONFIG_ENCRYPTION_KEY_FILE must be absolute")
|
||||
}
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil || len(data) != 32 {
|
||||
return Config{}, fmt.Errorf("payment config encryption key must be exactly 32 raw bytes")
|
||||
}
|
||||
c.PaymentConfigEncryptionKey = data
|
||||
}
|
||||
if root := getenv("PACKAGE_STORAGE_ROOT"); root != "" {
|
||||
if !filepath.IsAbs(root) {
|
||||
return Config{}, fmt.Errorf("PACKAGE_STORAGE_ROOT must be absolute")
|
||||
|
||||
Reference in New Issue
Block a user