diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 75e890abc2..3f0ecd84c5 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -43,13 +43,13 @@ jobs: verbose: true - run: yarn test:e2e:ci - - name: Build and Push Staging Docker Image + - name: Build and Push Development Docker Image # Only run on push if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }} run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD yarn build - yarn build:docker:staging + yarn build:docker:develop env: DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml index 7fb78c3ef3..92765c29bf 100644 --- a/hosting/docker-compose.yaml +++ b/hosting/docker-compose.yaml @@ -29,6 +29,7 @@ services: - ./logs:/logs depends_on: - worker-service + - redis-service worker-service: restart: always diff --git a/hosting/envoy.dev.yaml.hbs b/hosting/envoy.dev.yaml.hbs index 080311ee49..76417b3e0d 100644 --- a/hosting/envoy.dev.yaml.hbs +++ b/hosting/envoy.dev.yaml.hbs @@ -38,6 +38,11 @@ static_resources: route: cluster: server-dev + - match: { prefix: "/app/" } + route: + cluster: server-dev + prefix_rewrite: "/" + # the below three cases are needed to make sure # all traffic prefixed for the builder is passed through # correctly. diff --git a/hosting/scripts/linux/release-to-docker-hub.sh b/hosting/scripts/linux/release-to-docker-hub.sh index b1a79c964c..b3c380f729 100755 --- a/hosting/scripts/linux/release-to-docker-hub.sh +++ b/hosting/scripts/linux/release-to-docker-hub.sh @@ -8,9 +8,5 @@ echo "Tagging images with SHA: $GITHUB_SHA and tag: $tag" docker tag app-service budibase/apps:$tag docker tag worker-service budibase/worker:$tag -# Tag with git sha -docker tag app-service budibase/apps:$GITHUB_SHA -docker tag worker-service budibase/worker:$GITHUB_SHA - -docker push budibase/apps -docker push budibase/worker +docker push budibase/apps:$tag +docker push budibase/worker:$tag diff --git a/package.json b/package.json index aa4cc3e79b..5a0a0d7495 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,6 @@ "test:e2e": "lerna run cy:test", "test:e2e:ci": "lerna run cy:ci", "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -", - "build:docker:staging": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh staging && cd -" + "build:docker:develop": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -" } } diff --git a/packages/auth/src/middleware/authenticated.js b/packages/auth/src/middleware/authenticated.js index 5d9056b19a..64494f709d 100644 --- a/packages/auth/src/middleware/authenticated.js +++ b/packages/auth/src/middleware/authenticated.js @@ -22,6 +22,12 @@ function buildNoAuthRegex(patterns) { }) } +function finalise(ctx, { authenticated, user, internal } = {}) { + ctx.isAuthenticated = authenticated || false + ctx.user = user + ctx.internal = internal || false +} + module.exports = (noAuthPatterns = [], opts) => { const noAuthOptions = noAuthPatterns ? buildNoAuthRegex(noAuthPatterns) : [] return async (ctx, next) => { @@ -36,35 +42,39 @@ module.exports = (noAuthPatterns = [], opts) => { return next() } try { - const apiKey = ctx.request.headers["x-budibase-api-key"] // check the actual user is authenticated first const authCookie = getCookie(ctx, Cookies.Auth) - - // this is an internal request, no user made it - if (apiKey && apiKey === env.INTERNAL_API_KEY) { - ctx.isAuthenticated = true - ctx.internal = true - } else if (authCookie) { + let authenticated = false, + user = null, + internal = false + if (authCookie) { try { const db = database.getDB(StaticDatabases.GLOBAL.name) - const user = await db.get(authCookie.userId) + user = await db.get(authCookie.userId) delete user.password - ctx.isAuthenticated = true - ctx.user = user + authenticated = true } catch (err) { // remove the cookie as the use does not exist anymore clearCookie(ctx, Cookies.Auth) } } - // be explicit - if (ctx.isAuthenticated !== true) { - ctx.isAuthenticated = false + const apiKey = ctx.request.headers["x-budibase-api-key"] + // this is an internal request, no user made it + if (!authenticated && apiKey && apiKey === env.INTERNAL_API_KEY) { + authenticated = true + internal = true } + // be explicit + if (authenticated !== true) { + authenticated = false + } + // isAuthenticated is a function, so use a variable to be able to check authed state + finalise(ctx, { authenticated, user, internal }) return next() } catch (err) { // allow configuring for public access if (opts && opts.publicAllowed) { - ctx.isAuthenticated = false + finalise(ctx, { authenticated: false }) } else { ctx.throw(err.status || 403, err) } diff --git a/packages/bbui/src/Form/Core/Combobox.svelte b/packages/bbui/src/Form/Core/Combobox.svelte index 5ea94bf0a4..2f832ad91e 100644 --- a/packages/bbui/src/Form/Core/Combobox.svelte +++ b/packages/bbui/src/Form/Core/Combobox.svelte @@ -63,9 +63,9 @@ on:focus={() => (focus = true)} on:blur={() => (focus = false)} on:change={onChange} - {value} + value={value || ""} + placeholder={placeholder || ""} {disabled} - {placeholder} class="spectrum-Textfield-input spectrum-InputGroup-input" /> diff --git a/packages/bbui/src/Modal/Modal.svelte b/packages/bbui/src/Modal/Modal.svelte index 12c12e3717..3ed9b93fa5 100644 --- a/packages/bbui/src/Modal/Modal.svelte +++ b/packages/bbui/src/Modal/Modal.svelte @@ -27,9 +27,17 @@ visible = false } + export function cancel() { + if (!visible) { + return + } + dispatch("cancel") + hide() + } + function handleKey(e) { if (visible && e.key === "Escape") { - hide() + cancel() } } @@ -41,7 +49,7 @@ } } - setContext(Context.Modal, { show, hide }) + setContext(Context.Modal, { show, hide, cancel }) @@ -56,15 +64,17 @@
-