2.4.25 • Published 23 days ago

@amazeelabs/publisher v2.4.25

Weekly downloads
-
License
-
Repository
-
Last release
23 days ago

Publisher

Installation

pnpm add @amazeelabs/publisher

Create publisher.config.ts file in the root of your project:

import { defineConfig } from '@amazeelabs/publisher';

export default defineConfig({
  // ...
});

Usage

pnpm publisher --help

Authentication

Can be configured in publisher.config.ts

If several authentication methods are configured, OAuth2 will be favoured. If there is no configuration, access to all routes will be granted.

For local development environments, to override configuration and skip authentication, use

PUBLISHER_SKIP_AUTHENTICATION=true

OAuth2

Prerequisite: OAuth2 server, like Drupal.

There are 2 methods: Authorization Code and Resource Owner Password. The first one should be favoured in most cases. It will ask the user to grant access to Publisher the first time then use the Drupal user login form for authentication if needed (or just redirect if the user is already authenticated in Drupal).

The second one can be used as a minimal implementation if the challenge is to be exposed in the client / the backend is only accessible from the client and not the end user.

Authorization Code

Add environment variables corresponding to the server: OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_TOKEN_PATH, OAUTH2_TOKEN_HOST, OAUTH2_AUTHORIZE_PATH, OAUTH2_SESSION_SECRET, OAUTH2_ENVIRONMENT_TYPE

  • OAUTH2_SESSION_SECRET: used for encryption of tokens
  • OAUTH2_ENVIRONMENT_TYPE: development or production, the latter uses secure cookies
export default defineConfig({
  oAuth2: {
    clientId: process.env.OAUTH2_CLIENT_ID || 'publisher',
    clientSecret: process.env.OAUTH2_CLIENT_ID || 'publisher',
    scope: process.env.OAUTH2_SCOPE || 'publisher',
    tokenHost: process.env.OAUTH2_TOKEN_HOST || 'http://127.0.0.1:8888',
    tokenPath: process.env.OAUTH2_TOKEN_PATH || '/oauth/token',
    authorizePath:
      process.env.OAUTH2_AUTHORIZE_PATH ||
      '/oauth/authorize?response_type=code',
    sessionSecret: process.env.OAUTH2_SESSION_SECRET || 'banana',
    environmentType: process.env.OAUTH2_ENVIRONMENT_TYPE || 'development',
    grantType: OAuth2GrantTypes.AuthorizationCode,
  },
});

Resource Owner Password

Add environment variables corresponding to the server: OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_TOKEN_PATH, OAUTH2_TOKEN_HOST

export default defineConfig({
  oAuth2: {
    clientId: process.env.OAUTH2_CLIENT_ID || 'publisher',
    clientSecret: process.env.OAUTH2_CLIENT_SECRET || 'publisher',
    tokenHost: process.env.OAUTH2_TOKEN_HOST || 'http://127.0.0.1:8888',
    tokenPath: process.env.OAUTH2_TOKEN_PATH || '/oauth/token',
    grantType: OAuth2GrantTypes.ResourceOwnerPassword,
  },
});

Basic Auth

export default defineConfig({
  basicAuth: {
    username: process.env.BASIC_AUTH_USERNAME || 'publisher',
    password: process.env.BASIC_AUTH_PASSWORD || 'publisher',
  },
});

Slack notifications

To be notified in case of failure.

Mandatory environment variables

  • Slack Webhook (documentation) PUBLISHER_SLACK_WEBHOOK="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
  • Slack Channel PUBLISHER_SLACK_CHANNEL="#project-ci-channel"

Optional environment variables

  • Publisher url, without a trailing slash. Adds a link to the status page, to the notification message. PUBLISHER_URL="https://build.project.com"
  • Project and Environment (Lagoon only). Adds LAGOON_PROJECT and LAGOON_ENVIRONMENT to the notification message.
2.4.25

23 days ago

2.4.24

2 months ago

2.4.23

3 months ago

2.4.22

3 months ago

2.4.21

3 months ago

2.4.20

4 months ago

2.4.18

4 months ago

2.4.19

4 months ago

2.4.17

4 months ago

2.4.16

4 months ago

2.4.14

5 months ago

2.4.15

5 months ago

2.4.13

6 months ago

2.4.12

6 months ago

2.4.1

9 months ago

2.4.0

9 months ago

2.4.3

7 months ago

2.4.2

8 months ago

2.4.5

7 months ago

2.4.4

7 months ago

2.3.0

9 months ago

2.4.10

7 months ago

2.4.11

7 months ago

2.4.7

7 months ago

2.4.6

7 months ago

2.4.9

7 months ago

2.4.8

7 months ago

2.2.1

11 months ago

2.2.0

11 months ago

2.1.21

11 months ago

2.1.20

11 months ago

2.1.16

1 year ago

2.1.17

1 year ago

2.1.14

1 year ago

2.1.15

1 year ago

2.1.12

1 year ago

2.1.13

1 year ago

2.1.11

1 year ago

2.1.18

1 year ago

2.1.19

1 year ago

0.14.11

1 year ago

0.14.10

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.8

1 year ago

0.15.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

2.1.9

1 year ago

2.1.10

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.0

1 year ago

0.14.5

1 year ago

0.14.6

1 year ago

0.14.7

1 year ago

0.14.8

1 year ago

0.14.9

1 year ago

0.14.4

1 year ago

0.13.0

2 years ago

0.12.0

2 years ago

0.12.1

2 years ago

0.14.0

2 years ago

0.12.2

2 years ago

0.14.1

2 years ago

0.14.2

2 years ago

0.14.3

1 year ago

0.11.0

2 years ago

0.11.1

2 years ago

0.10.7

2 years ago

0.10.4

2 years ago

0.10.5

2 years ago

0.10.6

2 years ago

0.8.5

2 years ago

0.8.4

2 years ago

0.9.0

2 years ago

0.9.1

2 years ago

0.10.1

2 years ago

0.10.2

2 years ago

0.10.3

2 years ago

0.10.0

2 years ago

0.8.3

2 years ago

0.8.2

2 years ago

0.7.6

2 years ago

0.7.5

2 years ago

0.8.1

2 years ago

0.7.2

2 years ago

0.8.0

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.4.9

2 years ago

0.4.8

2 years ago

0.4.10

2 years ago

0.4.11

2 years ago

0.5.4

2 years ago

0.4.5

2 years ago

0.7.1

2 years ago

0.5.3

2 years ago

0.4.7

2 years ago

0.5.5

2 years ago

0.4.6

2 years ago

0.5.0

2 years ago

0.7.0

2 years ago

0.5.2

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago