Skip to content

Commit

Permalink
chore: prettier automated code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Aug 24, 2024
1 parent 2eabdd2 commit e016c00
Show file tree
Hide file tree
Showing 14 changed files with 1,621 additions and 1,632 deletions.
10 changes: 5 additions & 5 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
engines:
eslint:
enabled: true
channel: "eslint-6"
channel: 'eslint-6'
config:
config: ".eslintrc.yaml"
config: '.eslintrc.yaml'

ratings:
paths:
- "**.js"
paths:
- '**.js'

checks:
return-statements:
Expand All @@ -22,4 +22,4 @@ checks:
threshold: 45
method-complexity:
config:
threshold: 6
threshold: 6
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
allow:
- dependency-type: production
41 changes: 20 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: CI

on: [ push, pull_request ]
on: [push, pull_request]

env:
CI: true

jobs:

lint:
uses: haraka/.github/.github/workflows/lint.yml@master

Expand All @@ -15,31 +14,31 @@ jobs:
# secrets: inherit

test:
needs: [ lint, get-lts ]
needs: [lint, get-lts]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
os: [ubuntu-latest]
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 8.8.0
security-enabled: false
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 8.8.0
security-enabled: false
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test

get-lts:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
schedule:
- cron: '18 7 * * 4'

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- uses: miyataka/elasticsearch-github-actions@1
with:
stack-version: '7.6.2'
Expand All @@ -34,7 +34,7 @@ jobs:
- run: npm test

publish-npm:
needs: [ build ]
needs: [build]
runs-on: ubuntu-latest
environment: npm
steps:
Expand All @@ -43,14 +43,14 @@ jobs:
registry-url: https://registry.npmjs.org/
- uses: actions/checkout@v3
with:
fetch-depth: 0 # needed by GitHub Release
fetch-depth: 0 # needed by GitHub Release
- name: publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

publish-gpr:
needs: [ build ]
needs: [build]
runs-on: ubuntu-latest
environment: ghpm
permissions:
Expand All @@ -63,7 +63,7 @@ jobs:
- uses: actions/setup-node@v3
with:
registry-url: https://npm.pkg.github.com/
scope: "@haraka"
scope: '@haraka'
- name: rename package with @haraka scope
run: node .release/npm/prepend-scope.cjs @haraka
- run: npm publish
Expand Down
2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleQuote: true
semi: false
4 changes: 2 additions & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This handcrafted artisinal software is brought to you by:

| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=msimerson">74</a>)| <img height="80" src="https://avatars.githubusercontent.com/u/1674289?v=4"><br><a href="https://github.com/Dexus">Dexus</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=Dexus">2</a>)| <img height="80" src="https://avatars.githubusercontent.com/u/5239282?v=4"><br><a href="https://github.com/sriccio">sriccio</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=sriccio">2</a>)| <img height="80" src="https://avatars.githubusercontent.com/u/15035337?v=4"><br><a href="https://github.com/gtech99">gtech99</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=gtech99">1</a>)|
| :---: | :---: | :---: | :---: |
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=msimerson">74</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/1674289?v=4"><br><a href="https://github.com/Dexus">Dexus</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=Dexus">2</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/5239282?v=4"><br><a href="https://github.com/sriccio">sriccio</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=sriccio">2</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/15035337?v=4"><br><a href="https://github.com/gtech99">gtech99</a> (<a href="https://github.com/haraka/haraka-plugin-elasticsearch/commits?author=gtech99">1</a>) |
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |

<sub>this file is maintained by [.release](https://github.com/msimerson/.release)</sub>
21 changes: 4 additions & 17 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,94 +8,81 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

#### Added

-
-

#### Fixed

-
-

#### Changed

-
-
- Create index-template-map_es8.json (#54)
Template for Elastic Search 8

Template for Elastic Search 8

### [8.0.2] - 2023-12-03

- Update auth example for ES 8.x (#51)
- Update tls connection options for ES 8 (#49)


### [8.0.0] - 2023-06-09

- dep(elastic): bump dep version to 8.8
- update @elastic syntax to promise API


### [7.0.0] - 2023-06-08

- chore: update ci & packaging
- dep(elastic): bump dep version to 7.17
- bump major version to match ES major version


### [1.1.0] - 2023-06-08

- dep(elastic): dump dep version to 8.8


### [1.0.8] - 2022-06-06

- ci: add .npmignore
- ci: publish needs es started up too


### [1.0.7] - 2022-06-06

- ci: use shared GHA workflows
- ci: add submodule .release
- es7: update index map template


### 1.0.6 - 2020-07-21

- add URI for connection settings
- add options to specify user & ssl connection settings
- bump elasticsearch client to version 7.8


### 1.0.5 - 2020-04-29

- update to upstream @elastic/elasticsearch@6
- convert test runner to mocha
- use GitHub actions instead of Travis & AppVeyor
- package.json: depend on latest eslint


### 1.0.4 - 2019-09-22

- update index template for ES 6


### 1.0.3 - 2017-08-22

- fix txr variable scope
- add tests for get_es_hosts


### 1.0.2 - 2017-07-29

- also prune null values because typeof null === object
- add test storing doc against index template
- get ES testing working on AppVeyor (windows)


### 1.0.1 - 2017-07-29

- qualify the path to plugin.\*.msg to avoid collision


### 1.0.0 - 2017-07-14

- initial release
Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ config/elasticsearch.ini
$EDITOR config/elasticsearch.ini
```


# Logging

Unless errors are encountered, no logs are emitted.
Expand All @@ -36,43 +35,42 @@ The elasticsearch module has very robust error handling built in. If there's a
connection issue, errors such as these will be emitted when Haraka starts
up:

* Elasticsearch cluster is down!
* No Living connections
- Elasticsearch cluster is down!
- No Living connections

However, ES will continue attempting to connect and when the ES server(s) are
available, logging will begin. If errors are encountered trying to save data
to ES, they look like this:

* No Living connections
* Request Timeout after 30000ms
- No Living connections
- Request Timeout after 30000ms

They normally fix themselves when ES resumes working properly.

# Configuration

* host - an IP or hostname of the ES server to connect to
- host - an IP or hostname of the ES server to connect to

host=127.0.0.2
host=127.0.0.2

* pluginObject
- pluginObject

By default, all plugin results are presented as `$plugin_name: { ... }`, at
the top level. If you prefer that all plugin results be nested inside an
object `$obj: { $plugin_name: { ...}`, set pluginObject to that object's key name

pluginObject=plugin


* [ignore_hosts]
- [ignore_hosts]

A config file section for hosts whose results should not be stored in
ES. HAproxy servers, Nagios, and other hosts who monitor Haraka can be listed
here. The format for entries is host.name=true

* [index]
- [index]

transaction=smtp-transaction
connection=smtp-connection
transaction=smtp-transaction
connection=smtp-connection

Transactions include all the connection information and are "the good stuff."
When a connection has transactions, the connection is not saved separately.
Expand All @@ -81,7 +79,6 @@ transactions. The connections index tends to be mostly noise (monitoring,
blocked connections, bruteforce auth attempts, etc.). To collapse them into
the same index, set the value for both identically.


# Index map template

Creating a map template will apply the template(s) to any future indexes that
Expand All @@ -92,8 +89,8 @@ an index map template from the sample file in this package:
curl -X PUT 'http://localhost:9200/_template/haraka_results' -H 'Content-Type: application/json' -d @index-map-template.json
```


<!-- leave these buried at the bottom of the document -->

[ci-img]: https://github.com/haraka/haraka-plugin-elasticsearch/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/haraka/haraka-plugin-elasticsearch/actions/workflows/ci.yml
[clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-elasticsearch/badges/gpa.svg
Expand Down
Loading

0 comments on commit e016c00

Please sign in to comment.