Skip to content

Commit

Permalink
fix: Downloadable Config - org name, and credential names can have sp…
Browse files Browse the repository at this point in the history
…aces

Closes #197
  • Loading branch information
shazron committed Apr 28, 2020
1 parent ee514d2 commit 019113e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions schema/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"id": { "type": "string" },
"name": {
"type": "string",
"pattern": "^[a-zA-Z0-9]+$"
"pattern": "^[ a-zA-Z0-9]+$"
},
"ims_org_id": {
"type": "string",
Expand All @@ -92,7 +92,7 @@
"id": { "type": "string" },
"name": {
"type": "string",
"pattern": "^[a-zA-Z0-9]+$"
"pattern": "^[ a-zA-Z0-9]+$"
},
"integration_type": {
"type": "string",
Expand Down
4 changes: 3 additions & 1 deletion src/lib/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ function transformCredentials (credentials, imsOrgId) {
if (!value) {
value = credential.jwt
}
acc[credential.name] = value

const name = credential.name.replace(/ /gi, '_') // replace any spaces with underscores
acc[name] = value

return acc
}, {})
Expand Down
2 changes: 1 addition & 1 deletion test/__fixtures__/existing.merged.aio
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"description": "My project description",
"org": {
"id": "25591412",
"name": "Developers",
"name": "Developers Developers Developers",
"ims_org_id": "XOXOXOXOXOXOX@AdobeOrg"
},
"workspace": {
Expand Down
12 changes: 6 additions & 6 deletions test/__fixtures__/existing.merged.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ AIO_foo_bar=baz
AIO_boo=faz
AIO_runtime_auth=Auth
AIO_runtime_namespace=Name
AIO_$ims_ProjectA_client__id=XYXYXYXYXYXYXYXYX
AIO_$ims_ProjectA_client__secret=XYXYXYXYZZZZZZ
AIO_$ims_ProjectA_redirect__uri=https://test123
AIO_$ims_Project__A_client__id=XYXYXYXYXYXYXYXYX
AIO_$ims_Project__A_client__secret=XYXYXYXYZZZZZZ
AIO_$ims_Project__A_redirect__uri=https://test123
AIO_$ims_ProjectB_client__id=XUXUXUXUXUXUXUX
AIO_$ims_ProjectB_client__secret=XPXPXPXPXPXPXPXPX
AIO_$ims_ProjectB_techacct=XTXTXTXTXTX@techacct.adobe.com
AIO_$ims_ProjectB_meta__scopes=["ent_smartcontent_sdk","ent_adobeio_sdk"]
AIO_$ims_ProjectB_ims__org__id=XOXOXOXOXOXOX@AdobeOrg
AIO_$ims_NewTestIntegration8_client__id=XRXRXRXRXRXRXRXRXR
AIO_$ims_NewTestIntegration8_client__secret=XRXRXRXRXRXRXRXRXRX
AIO_$ims_NewTestIntegration8_redirect__uri=ams:\\+TRTRTRTRTRTR://adobeid/XWXWXWXWXWXWXWX
AIO_$ims_New__Test__Integration__8_client__id=XRXRXRXRXRXRXRXRXR
AIO_$ims_New__Test__Integration__8_client__secret=XRXRXRXRXRXRXRXRXRX
AIO_$ims_New__Test__Integration__8_redirect__uri=ams:\\+TRTRTRTRTRTR://adobeid/XWXWXWXWXWXWXWX
2 changes: 1 addition & 1 deletion test/__fixtures__/valid.config.aio
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "My project description",
"org": {
"id": "25591412",
"name": "Developers",
"name": "Developers Developers Developers",
"ims_org_id": "XOXOXOXOXOXOX@AdobeOrg"
},
"workspace": {
Expand Down
12 changes: 6 additions & 6 deletions test/__fixtures__/valid.config.env
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
AIO_runtime_auth=Auth
AIO_runtime_namespace=Name
AIO_$ims_ProjectA_client__id=XYXYXYXYXYXYXYXYX
AIO_$ims_ProjectA_client__secret=XYXYXYXYZZZZZZ
AIO_$ims_ProjectA_redirect__uri=https://test123
AIO_$ims_Project__A_client__id=XYXYXYXYXYXYXYXYX
AIO_$ims_Project__A_client__secret=XYXYXYXYZZZZZZ
AIO_$ims_Project__A_redirect__uri=https://test123
AIO_$ims_ProjectB_client__id=XUXUXUXUXUXUXUX
AIO_$ims_ProjectB_client__secret=XPXPXPXPXPXPXPXPX
AIO_$ims_ProjectB_techacct=XTXTXTXTXTX@techacct.adobe.com
AIO_$ims_ProjectB_meta__scopes=["ent_smartcontent_sdk","ent_adobeio_sdk"]
AIO_$ims_ProjectB_ims__org__id=XOXOXOXOXOXOX@AdobeOrg
AIO_$ims_NewTestIntegration8_client__id=XRXRXRXRXRXRXRXRXR
AIO_$ims_NewTestIntegration8_client__secret=XRXRXRXRXRXRXRXRXRX
AIO_$ims_NewTestIntegration8_redirect__uri=ams:\\+TRTRTRTRTRTR://adobeid/XWXWXWXWXWXWXWX
AIO_$ims_New__Test__Integration__8_client__id=XRXRXRXRXRXRXRXRXR
AIO_$ims_New__Test__Integration__8_client__secret=XRXRXRXRXRXRXRXRXRX
AIO_$ims_New__Test__Integration__8_redirect__uri=ams:\\+TRTRTRTRTRTR://adobeid/XWXWXWXWXWXWXWX
6 changes: 3 additions & 3 deletions test/__fixtures__/valid.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "My project description",
"org": {
"id": "25591412",
"name": "Developers",
"name": "Developers Developers Developers",
"ims_org_id": "XOXOXOXOXOXOX@AdobeOrg"
},
"workspace": {
Expand All @@ -20,7 +20,7 @@
"credentials": [
{
"id": "17561142",
"name": "ProjectA",
"name": "Project A",
"integration_type": "oauthweb",
"oauth2": {
"client_id": "XYXYXYXYXYXYXYXYX",
Expand All @@ -44,7 +44,7 @@
},
{
"id": "17950",
"name": "NewTestIntegration8",
"name": "New Test Integration 8",
"integration_type": "oauthandroid",
"oauth2": {
"client_id": "XRXRXRXRXRXRXRXRXR",
Expand Down

0 comments on commit 019113e

Please sign in to comment.