Skip to content

Commit

Permalink
define interfaces package, start using interfaces.Storage for transac…
Browse files Browse the repository at this point in the history
…tions [#613]
  • Loading branch information
roberlander2 committed Dec 15, 2022
1 parent f5e8f60 commit 2301a12
Show file tree
Hide file tree
Showing 17 changed files with 1,201 additions and 1,164 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/Yelp/detect-secrets
rev: v1.0.3
rev: v1.4.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
145 changes: 80 additions & 65 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.3",
"version": "1.4.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
Expand All @@ -20,6 +20,12 @@
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
Expand All @@ -46,6 +52,9 @@
{
"name": "PrivateKeyDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
Expand All @@ -66,10 +75,6 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
Expand All @@ -80,6 +85,12 @@
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
Expand All @@ -90,13 +101,10 @@
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.regex.should_exclude_file",
"pattern": [
"go.sum"
]
"path": "detect_secrets.filters.heuristic.is_templated_secret"
}
],
"results": {
Expand All @@ -109,31 +117,52 @@
"line_number": 38
}
],
"core/apis.go": [
"core/app_services.go": [
{
"type": "Secret Keyword",
"filename": "core/apis.go",
"hashed_secret": "f776bc8b6836b3498c27139f23f5d64e4041af0f",
"filename": "core/app_services.go",
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
"is_verified": false,
"line_number": 164
"line_number": 159
}
],
"core/auth/apis.go": [
{
"type": "Secret Keyword",
"filename": "core/auth/apis.go",
"hashed_secret": "4d55af37dbbb6a42088d917caa1ca25428ec42c9",
"hashed_secret": "394e3412459f79523e12e1fa95a4cf141ccff122",
"is_verified": false,
"line_number": 2051
"line_number": 2038
}
],
"core/auth/auth.go": [
{
"type": "Secret Keyword",
"filename": "core/auth/auth.go",
"hashed_secret": "4d55af37dbbb6a42088d917caa1ca25428ec42c9",
"hashed_secret": "417355fe2b66baa6826739a6d8006ab2ddcf5186",
"is_verified": false,
"line_number": 145
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth.go",
"hashed_secret": "700f93e97a8aaf0664601a8f298ac5ad0ff13c37",
"is_verified": false,
"line_number": 147
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth.go",
"hashed_secret": "58f3388441fbce0e48aef2bf74413a6f43f6dc70",
"is_verified": false,
"line_number": 2384
"line_number": 897
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth.go",
"hashed_secret": "94a7f0195bbbd2260c4e4d02b6348fbcd90b2b30",
"is_verified": false,
"line_number": 2385
}
],
"core/auth/auth_type_email.go": [
Expand All @@ -154,9 +183,9 @@
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "04e110541a2e8b44bc10939bfaf5d82adfe45158",
"hashed_secret": "06354d205ab5a3b6c7ad2333c58f1ddc810c97ba",
"is_verified": false,
"line_number": 109
"line_number": 87
},
{
"type": "Secret Keyword",
Expand All @@ -168,9 +197,9 @@
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "f32ddb18dd630c4bb16a5ab053c62d99c94df67f",
"hashed_secret": "69411040443be576ce64fc793269d7c26dd0866a",
"is_verified": false,
"line_number": 258
"line_number": 253
},
{
"type": "Secret Keyword",
Expand All @@ -196,11 +225,20 @@
"line_number": 377
}
],
"core/auth/service_static_token.go": [
{
"type": "Secret Keyword",
"filename": "core/auth/service_static_token.go",
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
"is_verified": false,
"line_number": 78
}
],
"driven/emailer/adapter.go": [
{
"type": "Secret Keyword",
"filename": "driven/emailer/adapter.go",
"hashed_secret": "1282d4ec63996a2c4dcb73835bad1c27ea1f901c",
"hashed_secret": "9df4524d2441f00999342c4541a39932198d4bb4",
"is_verified": false,
"line_number": 70
}
Expand All @@ -214,70 +252,47 @@
"line_number": 224
}
],
"driver/web/docs/gen/def.yaml": [
"driven/storage/database.go": [
{
"type": "Secret Keyword",
"filename": "driver/web/docs/gen/def.yaml",
"hashed_secret": "dd29ecf524b030a65261e3059c48ab9e1ecb2585",
"filename": "driven/storage/database.go",
"hashed_secret": "6547f385c6d867e20f8217018a4d468a7d67d638",
"is_verified": false,
"line_number": 1408
"line_number": 203
}
],
"driver/web/docs/resources/services/application/configs.yaml": [
"driver/web/apis_system.go": [
{
"type": "Secret Keyword",
"filename": "driver/web/docs/resources/services/application/configs.yaml",
"hashed_secret": "dd29ecf524b030a65261e3059c48ab9e1ecb2585",
"filename": "driver/web/apis_system.go",
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
"is_verified": false,
"line_number": 19
"line_number": 692
}
],
"driver/web/ui/reset-credential.html": [
{
"type": "Secret Keyword",
"filename": "driver/web/ui/reset-credential.html",
"hashed_secret": "ad88769c02358be4b1d42944359820977c4eec28",
"is_verified": false,
"line_number": 195
},
{
"type": "Secret Keyword",
"filename": "driver/web/ui/reset-credential.html",
"hashed_secret": "063afcf87eabb84dc0dc528d1b30266217aa71c3",
"is_verified": false,
"line_number": 196
}
],
"main.go": [
{
"type": "Secret Keyword",
"filename": "main.go",
"hashed_secret": "7ee294e78b33e56f1f32f05e03847461cb0008df",
"is_verified": false,
"line_number": 94
},
"driver/web/docs/gen/gen_types.go": [
{
"type": "Secret Keyword",
"filename": "main.go",
"hashed_secret": "d22d26f750c4f64214b43ec38aaf6e3456407f0a",
"filename": "driver/web/docs/gen/gen_types.go",
"hashed_secret": "c9739eab2dfa093cc0e450bf0ea81a43ae67b581",
"is_verified": false,
"line_number": 146
"line_number": 1564
},
{
"type": "Secret Keyword",
"filename": "main.go",
"hashed_secret": "4f2da4710cdfd5c9f655ceb78bcb5ed03c73ddfd",
"filename": "driver/web/docs/gen/gen_types.go",
"hashed_secret": "9afb15df443d57204a2a0f82e164a9c46749dec6",
"is_verified": false,
"line_number": 158
"line_number": 1943
},
{
"type": "Secret Keyword",
"filename": "main.go",
"hashed_secret": "24fe4e436894f6911a8234dbf81ad77417eac012",
"filename": "driver/web/docs/gen/gen_types.go",
"hashed_secret": "b296a47f167e06833104ebf060da1b4bbb4d619b",
"is_verified": false,
"line_number": 160
"line_number": 1946
}
]
},
"generated_at": "2022-11-10T19:40:13Z"
"generated_at": "2022-12-15T23:06:32Z"
}
6 changes: 3 additions & 3 deletions core/app_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ func (app *application) sysUpdateGlobalConfig(setting string) error {
}

gc.Setting = setting
transaction := func(context storage.TransactionContext) error {
transaction := func(sa storage.Adapter) error {
//1. clear the global config - we always keep only one global config
err := app.storage.DeleteGlobalConfig(context)
err := sa.DeleteGlobalConfig(context)
if err != nil {
return errors.WrapErrorAction(logutils.ActionDelete, model.TypeGlobalConfig, nil, err)
}

//2. add the new one
err = app.storage.CreateGlobalConfig(context, gc)
err = sa.CreateGlobalConfig(context, gc)
if err != nil {
return errors.WrapErrorAction(logutils.ActionInsert, model.TypeGlobalConfig, nil, err)
}
Expand Down
Loading

0 comments on commit 2301a12

Please sign in to comment.