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

feat(#458): Add DruxtAuth to DruxtSite example #547

Merged
merged 5 commits into from
Aug 9, 2022
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
5 changes: 4 additions & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ tasks:
cd $GITPOD_REPO_ROOT/docs/nuxt && yarn
cd $GITPOD_REPO_ROOT && yarn build:docs
command: |
# Setup Gitpod .env
$GITPOD_REPO_ROOT/.gitpod/scripts/env-setup.sh
Decipher marked this conversation as resolved.
Show resolved Hide resolved

# Start Drupal
cd $GITPOD_REPO_ROOT/docs/drupal && ddev start -y && ddev drush uli
cd $GITPOD_REPO_ROOT/docs/drupal && ddev start -y && ddev gitpod-config && ddev drush uli
Decipher marked this conversation as resolved.
Show resolved Hide resolved

# Display welcome message
cd $GITPOD_REPO_ROOT && cat .gitpod/WELCOME.md
Expand Down
3 changes: 2 additions & 1 deletion .gitpod/WELCOME.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
To get started you can do one of the following tasks:
- Run the Druxt build tools: `yarn build --watch`
- Run the Druxt test suite: `yarn test --watch`
- Generate Druxt documetation: `yarn build:docs`
- Generate Druxt documentation: `yarn build:docs`
- Start an example DruxtSite: `yarn example:druxt-site`
- Start the DruxtJS.org website: `cd docs/nuxt && yarn dev`

Happy contributing.
Expand Down
4 changes: 4 additions & 0 deletions .gitpod/scripts/env-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -eu -o pipefail

echo -en "OAUTH_CALLBACK=https://3000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}/callback" > $GITPOD_REPO_ROOT/docs/.env
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,40 @@ If you are able to resolve an issue, or have improvements you would like to prop

* * *

## Example projects

The Druxt monorepo contains a collection of example projects inside the aptly named "examples/" directory.

All projects are connected to the locally built codebase and should be used for testing during development.

All examples use the Drupal instance located @ `docs/drupal` (`cd docs/drupal && ddev start && ddev drupal-install`).

### Custom module

This a a bare bones example of a custom DruxtModule.

`cd examples/custom-module && yarn && yarn dev`

### DruxtSite

This is an example of a basic, un-themed DruxtSite with support for authenticated users.

`yarn example:druxt-site`

### Entity form

A basic contact form example of the DruxtEntityForm component.

`cd examples/entity-form && yarn && yarn dev`

### Node client

A non-Nuxt example, using the DruxtClient in a basic node app.

`cd examples/node-client && yarn && yarn dev`

* * *

## Development tools

The Druxt repository is setup with tools and automated processes to help with development and to ensure a maintainable project:
Expand Down
1 change: 1 addition & 0 deletions docs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OAUTH_CALLBACK=http://localhost:3000/callback
1 change: 1 addition & 0 deletions docs/drupal/.ddev/commands/web/drupal-install
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

composer install
drush -y tome:install
drush cache:rebuild
16 changes: 16 additions & 0 deletions docs/drupal/.ddev/commands/web/gitpod-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

## Description: Update Gitpod configuration in Drupal
## Usage: gitpod-config
## Example: "ddev gitpod-config"

# Update the Consumer redirect URL.
drush php-eval '
$consumer = \Drupal::service("entity.repository")->loadEntityByUuid("consumer", "1a6b8816-26de-4b70-bcdf-919600542f03");
$consumer->redirect = getenv("OAUTH_CALLBACK") ?: "http://localhost:3000/callback";
# var_dump($consumer->redirect->value);
$consumer->save();
'

# Rebuild cache.
drush cache:rebuild
8 changes: 8 additions & 0 deletions docs/drupal/.ddev/docker-compose.env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.6'

services:
web:
env_file:
- "$PWD/../.env"
volumes:
- "$PWD/../.env:/var/www/html/.env"
1 change: 1 addition & 0 deletions docs/drupal/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"drupal/decoupled_router": "2.0.3",
"drupal/druxt": "^1.1.1",
"drupal/jsonapi_hypermedia": "^1.6",
"drupal/simple_oauth": "^5.2",
"drupal/tome": "^1.6",
"drush/drush": "^11.0"
},
Expand Down
Loading