Skip to content

Commit

Permalink
add support to override prod and stage endpoints (for local dev testi…
Browse files Browse the repository at this point in the history
…ng purposes)
  • Loading branch information
shazron committed Jan 8, 2024
1 parent 3253b42 commit 2f12dbd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions e2e/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ governing permissions and limitations under the License.
/* ************* NOTE 1: these tests must be run sequentially, jest does it by default within a SINGLE file ************* */
/* ************* NOTE 2: requires env vars TEST_AUTH_1, TEST_NS_1 and TEST_AUTH_2, TEST_NS_2 for 2 different namespaces. ************* */

const stateLib = require('../index')
const path = require('node:path')
const { MAX_TTL_SECONDS } = require('../lib/constants')

// load .env values in the e2e folder, if any
require('dotenv').config({ path: path.join(__dirname, '.env') })

const { MAX_TTL_SECONDS } = require('../lib/constants')
const stateLib = require('../index')

const testKey = 'e2e_test_state_key'

jest.setTimeout(30000) // thirty seconds per test
Expand Down
10 changes: 8 additions & 2 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ governing permissions and limitations under the License.

const { PROD_ENV, STAGE_ENV } = require('@adobe/aio-lib-env')

// gets these values if the keys are set in the environment, if not it will use the defaults set
const {
ADOBE_STATE_STORE_ENDPOINT_PROD = 'https://storage-state-amer.app-builder.adp.adobe.io',
ADOBE_STATE_STORE_ENDPOINT_STAGE = 'http://storage-state-amer.stg.app-builder.corp.adp.adobe.io'
} = process.env

const ADOBE_STATE_STORE_ENDPOINT = {
[PROD_ENV]: 'https://storage-state-amer.app-builder.adp.adobe.io',
[STAGE_ENV]: 'http://storage-state-amer.stg.app-builder.corp.adp.adobe.io'
[PROD_ENV]: ADOBE_STATE_STORE_ENDPOINT_PROD,
[STAGE_ENV]: ADOBE_STATE_STORE_ENDPOINT_STAGE
}

const MAX_KEY_SIZE = 1024 * 1 // 1KB
Expand Down

0 comments on commit 2f12dbd

Please sign in to comment.