Skip to content
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
15 changes: 0 additions & 15 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
repository: "Drafteame/serverless-plugin-sync-secrets"
repository: 'Drafteame/serverless-plugin-sync-secrets'
branch: 'main'
directory: .
tags: true
Expand Down
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.4.0
- repo: local
hooks:
- id: eslint
name: eslint
entry: npx eslint --fix
language: system
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
types: [file]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/commitizen-tools/commitizen
rev: v3.27.0
Expand Down
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,17 @@ custom:

#### Configuration Options

| Option | Description |
|------------------|-------------|
| `ejson_file_path` | Path to the `EJSON` secrets file (default: `./secrets/{stage}.ejson`). |
| `ejson_key` | The `EJSON` private key (optional if `ssm_prefix` is set). |
| `ssm_prefix` | Prefix in `AWS SSM Parameter Store` to retrieve the `EJSON` private key (optional if `ejson_key` is provided). |
| `secret_name` | Name of the secret in `AWS Secrets Manager` (default: service name). |
| `exclude` | Regex pattern to exclude specific keys from synchronization (default: `'^_'`). |
| `create_secret` | If `true`, creates the secret in AWS Secrets Manager if it does not exist (default: `false`). |
| `show_values` | If `true`, shows the secret values in logs instead of markers (default: `false`). |
| `delete_secret` | If `true`, deletes the secret instead of creating or updating it (default: `false`). |
| `dry` | If `true`, runs in simulation mode without applying changes (default: `false`). |

| Option | Description |
| ----------------- | -------------------------------------------------------------------------------------------------------------- |
| `ejson_file_path` | Path to the `EJSON` secrets file (default: `./secrets/{stage}.ejson`). |
| `ejson_key` | The `EJSON` private key (optional if `ssm_prefix` is set). |
| `ssm_prefix` | Prefix in `AWS SSM Parameter Store` to retrieve the `EJSON` private key (optional if `ejson_key` is provided). |
| `secret_name` | Name of the secret in `AWS Secrets Manager` (default: service name). |
| `exclude` | Regex pattern to exclude specific keys from synchronization (default: `'^_'`). |
| `create_secret` | If `true`, creates the secret in AWS Secrets Manager if it does not exist (default: `false`). |
| `show_values` | If `true`, shows the secret values in logs instead of markers (default: `false`). |
| `delete_secret` | If `true`, deletes the secret instead of creating or updating it (default: `false`). |
| `dry` | If `true`, runs in simulation mode without applying changes (default: `false`). |

## Execution

Expand All @@ -96,8 +95,8 @@ provider:
custom:
syncSecrets:
ejson_file_path: ./secrets/${self:provider.stage}.ejson
ssm_prefix: "/ejson/keys/${self:provider.stage}/EJSON_KEY"
secret_name: "my-service"
ssm_prefix: '/ejson/keys/${self:provider.stage}/EJSON_KEY'
secret_name: 'my-service'
create_secret: true

plugins:
Expand All @@ -122,4 +121,4 @@ custom:

plugins:
- serverless-secret-sync-plugin
```
```
19 changes: 0 additions & 19 deletions eslint.config.js

This file was deleted.

54 changes: 54 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import globals from 'globals';
import { configs, plugins } from 'eslint-config-airbnb-extended';
import prettierConfig from 'eslint-config-prettier';

export default [
{
ignores: ['node_modules/', 'build/', 'coverage/', 'eslint.config.mjs'],
},
plugins.stylistic,
plugins.importX,
...configs.base.recommended,
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
},
parserOptions: {
ecmaVersion: 'latest',
},
},
rules: {
'import-x/extensions': ['error', 'ignorePackages'],
'import-x/no-useless-path-segments': ['error', { noUselessIndex: false }],
'no-restricted-syntax': 'off',
'no-continue': 'off',
'no-param-reassign': 'off',
'no-prototype-builtins': 'off',
'guard-for-in': 'off',
'no-underscore-dangle': 'off',
camelcase: 'off',
'class-methods-use-this': 'off',
},
},
{
files: ['tests/**/*.js'],
languageOptions: {
globals: {
describe: 'readonly',
it: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
before: 'readonly',
after: 'readonly',
},
},
rules: {
'no-unused-expressions': 'off',
},
},
prettierConfig,
];
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import SyncSecret from './src/SyncSecrets.js';
import Decrypt from './src/Decrypt.js';
import logger from './src/Logger.js';
import path from 'path';

export default class SyncSecretPlugin {
constructor(serverless, options) {
Expand Down Expand Up @@ -76,7 +76,7 @@ export default class SyncSecretPlugin {
this.config.create_secret,
this.config.delete_secret
);
const dry = this.config.dry;
const { dry } = this.config;

try {
logger.logInfo('Syncing secrets...');
Expand Down Expand Up @@ -105,7 +105,7 @@ export default class SyncSecretPlugin {
logger.logInfo('Loading plugin configuration...');

let config = { ...this.defaultConfig };
const service = this.serverless.service;
const { service } = this.serverless;

if (service.custom && service.custom.syncSecrets) {
config = { ...config, ...service.custom.syncSecrets };
Expand Down
Loading
Loading