Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCU-274 - Automigrate on sqlite #485

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions sdk/component/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/go-errors/errors"
"github.com/smithy-security/pkg/env"

"github.com/smithy-security/smithy/sdk"
"github.com/smithy-security/smithy/sdk/component/internal/uuid"
Expand Down Expand Up @@ -191,12 +192,12 @@ func newRunnerConfig() (*RunnerConfig, error) {
return nil, errors.Errorf("could not construct panic handler: %w", err)
}

componentName, err := fromEnvOrDefault(envVarKeyComponentName, "", withFallbackToDefaultOnError(true))
componentName, err := env.GetOrDefault(envVarKeyComponentName, "", env.WithDefaultOnError(true))
if err != nil {
return nil, errors.Errorf("could not lookup environment for '%s': %w", envVarKeyComponentName, err)
}

instanceIDStr, err := fromEnvOrDefault(envVarKeyInstanceID, "", withFallbackToDefaultOnError(true))
instanceIDStr, err := env.GetOrDefault(envVarKeyInstanceID, "", env.WithDefaultOnError(true))
if err != nil {
return nil, errors.Errorf("could not lookup environment for '%s': %w", envVarKeyInstanceID, err)
}
Expand All @@ -208,10 +209,10 @@ func newRunnerConfig() (*RunnerConfig, error) {
// --- END - BASIC ENV - END ---

// --- BEGIN - LOGGING ENV - BEGIN ---
logLevel, err := fromEnvOrDefault(
logLevel, err := env.GetOrDefault(
envVarKeyLoggingLogLevel,
RunnerConfigLoggingLevelDebug.String(),
withFallbackToDefaultOnError(true),
env.WithDefaultOnError(true),
)
if err != nil {
return nil, errors.Errorf("could not lookup environment for '%s': %w", envVarKeyLoggingLogLevel, err)
Expand All @@ -224,7 +225,7 @@ func newRunnerConfig() (*RunnerConfig, error) {
// --- END - LOGGING ENV - END ---

// --- BEGIN - STORER ENV - BEGIN ---
st, err := fromEnvOrDefault(envVarKeyBackendStoreType, "", withFallbackToDefaultOnError(true))
st, err := env.GetOrDefault(envVarKeyBackendStoreType, "", env.WithDefaultOnError(true))
if err != nil {
return nil, errors.Errorf("could not lookup environment for '%s': %w", envVarKeyBackendStoreType, err)
}
Expand All @@ -248,10 +249,10 @@ func newRunnerConfig() (*RunnerConfig, error) {

conf.storerConfig.storeType = storageType

dbDSN, err := fromEnvOrDefault(
dbDSN, err := env.GetOrDefault(
envVarKeyBackendStoreDSN,
"smithy.db",
andream16 marked this conversation as resolved.
Show resolved Hide resolved
withFallbackToDefaultOnError(true),
env.WithDefaultOnError(true),
)
if err != nil {
return nil, errors.Errorf("could not lookup environment for '%s': %w", envVarKeyBackendStoreDSN, err)
Expand Down
127 changes: 0 additions & 127 deletions sdk/component/env.go

This file was deleted.

Loading