Merge pull request #61 from foomo/sesamy-cli-0.5.2

Sesamy cli 0.5.2
This commit is contained in:
Kevin Franklin Kim 2024-11-05 13:58:32 +01:00 committed by GitHub
commit 427201c0c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 662 additions and 564 deletions

View File

@ -1,3 +1,4 @@
# Contributor Covenant Code of Conduct # Contributor Covenant Code of Conduct
## Our Pledge ## Our Pledge
@ -6,8 +7,8 @@ We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status, identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity nationality, personal appearance, race, caste, color, religion, or sexual
and orientation. identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community. diverse, inclusive, and healthy community.
@ -22,17 +23,17 @@ community include:
* Giving and gracefully accepting constructive feedback * Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, * Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience and learning from the experience
* Focusing on what is best not just for us as individuals, but for the * Focusing on what is best not just for us as individuals, but for the overall
overall community community
Examples of unacceptable behavior include: Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or * The use of sexualized language or imagery, and sexual attention or advances of
advances of any kind any kind
* Trolling, insulting or derogatory comments, and personal or political attacks * Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment * Public or private harassment
* Publishing others' private information, such as a physical or email * Publishing others' private information, such as a physical or email address,
address, without their explicit permission without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a * Other conduct which could reasonably be considered inappropriate in a
professional setting professional setting
@ -52,7 +53,7 @@ decisions when appropriate.
This Code of Conduct applies within all community spaces, and also applies when This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces. an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address, Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed posting via an official social media account, or acting as an appointed
representative at an online or offline event. representative at an online or offline event.
@ -60,7 +61,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at reported to the community leaders responsible for enforcement at
info@bestbytes.de. info@bestbytes.com.
All complaints will be reviewed and investigated promptly and fairly. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the All community leaders are obligated to respect the privacy and security of the
@ -82,15 +83,15 @@ behavior was inappropriate. A public apology may be requested.
### 2. Warning ### 2. Warning
**Community Impact**: A violation through a single incident or series **Community Impact**: A violation through a single incident or series of
of actions. actions.
**Consequence**: A warning with consequences for continued behavior. No **Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or like social media. Violating these terms may lead to a temporary or permanent
permanent ban. ban.
### 3. Temporary Ban ### 3. Temporary Ban
@ -109,20 +110,24 @@ Violating these terms may lead to a permanent ban.
standards, including sustained inappropriate behavior, harassment of an standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals. individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within **Consequence**: A permanent ban from any sort of public interaction within the
the community. community.
## Attribution ## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at version 2.1, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by [Mozilla's code of conduct Community Impact Guidelines were inspired by
enforcement ladder](https://github.com/mozilla/diversity). [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
https://www.contributor-covenant.org/translations. [https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

BIN
.github/assets/sesamy.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@ -1,6 +1,6 @@
The MIT License (MIT) MIT License
Copyright (c) Foomo Copyright (c) foomo by bestbytes
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,10 @@
.DEFAULT_GOAL:=help .DEFAULT_GOAL:=help
-include .makerc -include .makerc
# --- Config -----------------------------------------------------------------
export PATH := bin:$(PATH)
# --- Targets ----------------------------------------------------------------- # --- Targets -----------------------------------------------------------------
# This allows us to accept extra arguments # This allows us to accept extra arguments
@ -12,16 +16,16 @@
.husky: .husky:
@if ! command -v husky &> /dev/null; then \ @if ! command -v husky &> /dev/null; then \
echo "ERROR: missing executeable 'husky', please run:"; \ echo "ERROR: missing executeable 'husky', please run:"; \
echo "\n$ go install github.com/go-courier/husky/cmd/husky@latest\n"; \ echo "\n$ make brew\n"; \
fi fi
@git config core.hooksPath .husky @git config core.hooksPath .husky
## === Tasks === ## === Tasks ===
.PHONY: schema .PHONY: brew
## Open go schemas ## Install project binaries
schema: brew:
@helm schema-gen sesamy.yaml > sesamy.schema.json @ownbrew install
.PHONY: doc .PHONY: doc
## Open go docs ## Open go docs

View File

@ -1,10 +1,14 @@
# Sesamy CLI
[![Build Status](https://github.com/foomo/sesamy-cli/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/foomo/sesamy-cli/actions/workflows/test.yml) [![Build Status](https://github.com/foomo/sesamy-cli/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/foomo/sesamy-cli/actions/workflows/test.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/foomo/sesamy-cli)](https://goreportcard.com/report/github.com/foomo/sesamy-cli) [![Go Report Card](https://goreportcard.com/badge/github.com/foomo/sesamy-cli)](https://goreportcard.com/report/github.com/foomo/sesamy-cli)
[![godoc](https://godoc.org/github.com/foomo/sesamy-cli?status.svg)](https://godoc.org/github.com/foomo/sesamy-cli) [![GoDoc](https://godoc.org/github.com/foomo/sesamy-cli?status.svg)](https://godoc.org/github.com/foomo/sesamy-cli)
[![goreleaser](https://github.com/foomo/sesamy-cli/actions/workflows/release.yml/badge.svg)](https://github.com/foomo/sesamy-cli/actions) [![goreleaser](https://github.com/foomo/sesamy-cli/actions/workflows/release.yml/badge.svg)](https://github.com/foomo/sesamy-cli/actions)
<p align="center">
<img alt="sesamy" src=".github/assets/sesamy.png"/>
</p>
# Sesamy CLI
> CLI to keep you sane while working with GTM. > CLI to keep you sane while working with GTM.
## Installing ## Installing
@ -18,6 +22,31 @@ $ brew install foomo/tap/sesamy-cli
## Usage ## Usage
```shell
$ sesamy help
Server Side Tag Management System
Usage:
sesamy [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
config Print config
help Help about any command
tagmanager Provision Google Tag Manager containers
typescript Generate typescript events
version Print version
Flags:
-c, --config string config file (default is sesamy.yaml) (default "sesamy.yaml")
-h, --help help for sesamy
-v, --verbose output debug information
Use "sesamy [command] --help" for more information about a command.
```
## Configuration
Add a `sesamy.yaml` configuration Add a `sesamy.yaml` configuration
```yaml ```yaml
@ -359,3 +388,5 @@ Make a pull request...
## License ## License
Distributed under MIT License, please see license file within the code for more details. Distributed under MIT License, please see license file within the code for more details.
_Made with ♥ [foomo](https://www.foomo.org) by [bestbytes](https://www.bestbytes.com)_

5
go.mod
View File

@ -7,6 +7,7 @@ require (
github.com/foomo/go v0.0.3 github.com/foomo/go v0.0.3
github.com/foomo/gocontemplate v0.1.4 github.com/foomo/gocontemplate v0.1.4
github.com/foomo/sesamy-go v0.4.0 github.com/foomo/sesamy-go v0.4.0
github.com/invopop/jsonschema v0.12.0
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/mitchellh/hashstructure/v2 v2.0.2 github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/mitchellh/mapstructure v1.5.0 github.com/mitchellh/mapstructure v1.5.0
@ -28,6 +29,8 @@ require (
cloud.google.com/go/auth v0.9.8 // indirect cloud.google.com/go/auth v0.9.8 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect cloud.google.com/go/compute/metadata v0.5.2 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/containerd/console v1.0.3 // indirect github.com/containerd/console v1.0.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect
@ -45,6 +48,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@ -56,6 +60,7 @@ require (
github.com/spf13/cast v1.6.0 // indirect github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.opencensus.io v0.24.0 // indirect go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect

11
go.sum
View File

@ -24,6 +24,10 @@ github.com/MarvinJWendt/testza v0.4.2/go.mod h1:mSdhXiKH8sg/gQehJ63bINcCKp7RtYew
github.com/MarvinJWendt/testza v0.5.2 h1:53KDo64C1z/h/d/stCYCPY69bt/OSwjq5KpFNwi+zB4= github.com/MarvinJWendt/testza v0.5.2 h1:53KDo64C1z/h/d/stCYCPY69bt/OSwjq5KpFNwi+zB4=
github.com/MarvinJWendt/testza v0.5.2/go.mod h1:xu53QFE5sCdjtMCKk8YMQ2MnymimEctc4n3EjyIYvEY= github.com/MarvinJWendt/testza v0.5.2/go.mod h1:xu53QFE5sCdjtMCKk8YMQ2MnymimEctc4n3EjyIYvEY=
github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
@ -98,8 +102,11 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=
github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
@ -116,6 +123,8 @@ github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8
github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
@ -183,6 +192,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/wissance/stringFormatter v1.2.0 h1:lB0zcJkTA1O4Eb2qSTJmyapla/LihQt6NpJLghwWSb0= github.com/wissance/stringFormatter v1.2.0 h1:lB0zcJkTA1O4Eb2qSTJmyapla/LihQt6NpJLghwWSb0=
github.com/wissance/stringFormatter v1.2.0/go.mod h1:H7Mz15+5i8ypmv6bLknM/uD+U1teUW99PlW0DNCNscA= github.com/wissance/stringFormatter v1.2.0/go.mod h1:H7Mz15+5i8ypmv6bLknM/uD+U1teUW99PlW0DNCNscA=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=

39
main_test.go Normal file
View File

@ -0,0 +1,39 @@
package main_test
import (
"encoding/json"
"errors"
"os"
"path"
"testing"
testingx "github.com/foomo/go/testing"
tagx "github.com/foomo/go/testing/tag"
"github.com/foomo/sesamy-cli/pkg/config"
"github.com/invopop/jsonschema"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestConfig(t *testing.T) {
testingx.Tags(t, tagx.Short)
cwd, err := os.Getwd()
require.NoError(t, err)
reflector := new(jsonschema.Reflector)
require.NoError(t, reflector.AddGoComments("github.com/foomo/sesamy-cli", "./"))
schema := reflector.Reflect(&config.Config{})
actual, err := json.MarshalIndent(schema, "", " ")
require.NoError(t, err)
filename := path.Join(cwd, "sesamy.schema.json")
expected, err := os.ReadFile(filename)
if !errors.Is(err, os.ErrNotExist) {
require.NoError(t, err)
}
if !assert.Equal(t, string(expected), string(actual)) {
require.NoError(t, os.WriteFile(filename, actual, 0600))
}
}

16
ownbrew.yaml Normal file
View File

@ -0,0 +1,16 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/foomo/ownbrew/refs/tags/v0.1.0/ownbrew.schema.json
version: '1.0'
binDir: "bin"
tapDir: ".ownbrew/tap"
tempDir: ".ownbrew/tmp"
cellarDir: ".ownbrew/bin"
packages:
## https://github.com/golangci/golangci-lint/releases
- name: golangci-lint
tap: foomo/tap/golangci/golangci-lint
version: 1.61.0
## https://github.com/go-courier/husky/releases
- name: husky
tap: foomo/tap/go-courier/husky
version: 1.8.1

View File

@ -1,18 +1,30 @@
package config package config
type Config struct { type Config struct {
Version string `json:"version" yaml:"version"` // Config version
Version string `json:"version" yaml:"version" jsonschema:"required"`
// Globally redact visitor ip
RedactVisitorIP bool `json:"redactVisitorIp" yaml:"redactVisitorIp"` RedactVisitorIP bool `json:"redactVisitorIp" yaml:"redactVisitorIp"`
// Google Tag settings
GoogleTag GoogleTag `json:"googleTag" yaml:"googleTag"` GoogleTag GoogleTag `json:"googleTag" yaml:"googleTag"`
GoogleAPI GoogleAPI `json:"googleAPI" yaml:"googleAPI"` // Google API settings
GoogleAPI GoogleAPI `json:"googleApi" yaml:"googleApi"`
// Google Tag Manager settings
GoogleTagManager GoogleTagManager `json:"googleTagManager" yaml:"googleTagManager"` GoogleTagManager GoogleTagManager `json:"googleTagManager" yaml:"googleTagManager"`
// Providers // Google Ads provider settings
GoogleAds GoogleAds `json:"googleAds" yaml:"googleAds"` GoogleAds GoogleAds `json:"googleAds" yaml:"googleAds"`
// CookieBot provider settings
Cookiebot Cookiebot `json:"cookiebot" yaml:"cookiebot"` Cookiebot Cookiebot `json:"cookiebot" yaml:"cookiebot"`
// Google Analytics provider settings
GoogleAnalytics GoogleAnalytics `json:"googleAnalytics" yaml:"googleAnalytics"` GoogleAnalytics GoogleAnalytics `json:"googleAnalytics" yaml:"googleAnalytics"`
// Conversion Linker provider settings
ConversionLinker ConversionLinker `json:"conversionLinker" yaml:"conversionLinker"` ConversionLinker ConversionLinker `json:"conversionLinker" yaml:"conversionLinker"`
// Facebook provider settings
Facebook Facebook `json:"facebook" yaml:"facebook"` Facebook Facebook `json:"facebook" yaml:"facebook"`
// Emarsys provider settings
Emarsys Emarsys `json:"emarsys" yaml:"emarsys"` Emarsys Emarsys `json:"emarsys" yaml:"emarsys"`
// Tracify provider settings
Tracify Tracify `json:"tracify" yaml:"tracify"` Tracify Tracify `json:"tracify" yaml:"tracify"`
// Umami provider settings
Umami Umami `json:"umami" yaml:"umami"` Umami Umami `json:"umami" yaml:"umami"`
} }

View File

@ -166,14 +166,13 @@ function mapEventData() {
data: {}, data: {},
}; };
// Anonymized email address (optional, if available) // Anonymized email address (optional, if available)
if (eventData.user_id) { if (eventData.user_id) {
event.identity_dataidentity[anonymize(eventData.user_id)] = 1; event.identity_dataidentity[anonymize(eventData.user_id)] = 1;
} }
// Anonymized session id // Anonymized session id
if (sessionId) { if (remoteAddress && userAgent) {
event.identity_data[anonymize(sessionId)] = 2; event.identity_data[anonymize(remoteAddress+'|'+userAgent)] = 2;
} }
// Anonymized IP address // Anonymized IP address
if (remoteAddress) { if (remoteAddress) {
@ -184,7 +183,6 @@ function mapEventData() {
event.identity_data[anonymize(userAgent)] = 4; event.identity_data[anonymize(userAgent)] = 4;
} }
const url = parseUrl(pageLocation); const url = parseUrl(pageLocation);
switch (eventData.event_name) { switch (eventData.event_name) {
case 'tracify_page_view': { case 'tracify_page_view': {

View File

@ -1,288 +1,190 @@
{ {
"$schema": "http://json-schema.org/schema#", "$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object", "$id": "https://github.com/foomo/sesamy-cli/pkg/config/config",
"$ref": "#/$defs/Config",
"$defs": {
"Config": {
"properties": { "properties": {
"version": {
"type": "string",
"description": "Config version"
},
"redactVisitorIp": {
"type": "boolean",
"description": "Globally redact visitor ip"
},
"googleTag": {
"$ref": "#/$defs/GoogleTag",
"description": "Google Tag settings"
},
"googleApi": {
"$ref": "#/$defs/GoogleAPI",
"description": "Google API settings"
},
"googleTagManager": {
"$ref": "#/$defs/GoogleTagManager",
"description": "Google Tag Manager settings"
},
"googleAds": {
"$ref": "#/$defs/GoogleAds",
"description": "Google Ads provider settings"
},
"cookiebot": {
"$ref": "#/$defs/Cookiebot",
"description": "CookieBot provider settings"
},
"googleAnalytics": {
"$ref": "#/$defs/GoogleAnalytics",
"description": "Google Analytics provider settings"
},
"conversionLinker": { "conversionLinker": {
"$ref": "#/$defs/ConversionLinker",
"description": "Conversion Linker provider settings"
},
"facebook": {
"$ref": "#/$defs/Facebook",
"description": "Facebook provider settings"
},
"emarsys": {
"$ref": "#/$defs/Emarsys",
"description": "Emarsys provider settings"
},
"tracify": {
"$ref": "#/$defs/Tracify",
"description": "Tracify provider settings"
},
"umami": {
"$ref": "#/$defs/Umami",
"description": "Umami provider settings"
}
},
"additionalProperties": false,
"type": "object", "type": "object",
"required": [
"version",
"redactVisitorIp",
"googleTag",
"googleApi",
"googleTagManager",
"googleAds",
"cookiebot",
"googleAnalytics",
"conversionLinker",
"facebook",
"emarsys",
"tracify",
"umami"
]
},
"ConversionLinker": {
"properties": { "properties": {
"enabled": { "enabled": {
"type": "boolean" "type": "boolean"
}, },
"googleConsent": { "googleConsent": {
"$ref": "#/$defs/GoogleConsent"
}
},
"additionalProperties": false,
"type": "object", "type": "object",
"required": [
"enabled",
"googleConsent"
]
},
"Cookiebot": {
"properties": { "properties": {
"enabled": {
"type": "boolean"
},
"mode": {
"type": "string"
}
}
}
}
},
"cookiebot": {
"type": "object",
"properties": {
"advertiserConsentModeEnabled": {
"type": "boolean"
},
"cdnRegion": {
"type": "string"
},
"cookiebotId": {
"type": "string"
},
"enabled": { "enabled": {
"type": "boolean" "type": "boolean"
}, },
"templateName": { "templateName": {
"type": "string" "type": "string"
}, },
"cookiebotId": {
"type": "string"
},
"cdnRegion": {
"type": "string"
},
"urlPassthrough": { "urlPassthrough": {
"type": "boolean" "type": "boolean"
} },
"advertiserConsentModeEnabled": {
"type": "boolean"
} }
}, },
"emarsys": { "additionalProperties": false,
"type": "object", "type": "object",
"required": [
"enabled",
"templateName",
"cookiebotId",
"cdnRegion",
"urlPassthrough",
"advertiserConsentModeEnabled"
]
},
"Emarsys": {
"properties": { "properties": {
"enabled": { "enabled": {
"type": "boolean" "type": "boolean"
}, },
"googleConsent": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"mode": {
"type": "string"
}
}
},
"merchantId": { "merchantId": {
"type": "string" "type": "string"
}, },
"serverContainer": {
"type": "object",
"properties": {
"packages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"types": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
},
"facebook": {
"type": "object",
"properties": {
"apiAccessToken": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"googleConsent": { "googleConsent": {
"$ref": "#/$defs/GoogleConsent"
},
"webContainer": {
"$ref": "#/$defs/Config"
},
"serverContainer": {
"$ref": "#/$defs/Config"
}
},
"additionalProperties": false,
"type": "object", "type": "object",
"required": [
"enabled",
"merchantId",
"googleConsent",
"webContainer",
"serverContainer"
]
},
"Facebook": {
"properties": { "properties": {
"enabled": { "enabled": {
"type": "boolean" "type": "boolean"
}, },
"mode": {
"type": "string"
}
}
},
"pixelId": { "pixelId": {
"type": "string" "type": "string"
}, },
"serverContainer": { "apiAccessToken": {
"type": "object",
"properties": {
"packages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string" "type": "string"
}, },
"types": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"testEventToken": { "testEventToken": {
"type": "string" "type": "string"
}
}
},
"googleAds": {
"type": "object",
"properties": {
"conversion": {
"type": "object",
"properties": {
"conversionLabel": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"serverContainer": {
"type": "object",
"properties": {
"packages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"types": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
},
"conversionId": {
"type": "string"
},
"enabled": {
"type": "boolean"
}, },
"googleConsent": { "googleConsent": {
"type": "object", "$ref": "#/$defs/GoogleConsent"
"properties": {
"enabled": {
"type": "boolean"
},
"mode": {
"type": "string"
}
}
},
"remarketing": {
"type": "object",
"properties": {
"enableConversionLinker": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
}
}
}
}
},
"googleAnalytics": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"googleConsent": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"mode": {
"type": "string"
}
}
},
"googleGTag": {
"type": "object",
"properties": {
"ecommerceItems": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
},
"priority": {
"type": "integer"
}
}
}, },
"serverContainer": { "serverContainer": {
"type": "object", "$ref": "#/$defs/Config"
"properties": {
"packages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"types": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
} }
}, },
"webContainer": { "additionalProperties": false,
"type": "object", "type": "object",
"properties": { "required": [
"packages": { "enabled",
"type": "array", "pixelId",
"items": { "apiAccessToken",
"type": "object", "testEventToken",
"properties": { "googleConsent",
"path": { "serverContainer"
"type": "string" ]
}, },
"types": { "GoogleAPI": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
},
"googleApi": {
"type": "object",
"properties": { "properties": {
"credentials": { "credentials": {
"type": "string" "type": "string"
@ -293,229 +195,304 @@
"requestQuota": { "requestQuota": {
"type": "integer" "type": "integer"
} }
},
"additionalProperties": false,
"type": "object",
"required": [
"credentials",
"credentialsFile",
"requestQuota"
]
},
"GoogleAds": {
"properties": {
"enabled": {
"type": "boolean"
},
"googleConsent": {
"$ref": "#/$defs/GoogleConsent"
},
"conversionId": {
"type": "string"
},
"conversion": {
"$ref": "#/$defs/GoogleAdsConversion"
},
"remarketing": {
"$ref": "#/$defs/GoogleAdsRemarketing"
} }
}, },
"googleTag": { "additionalProperties": false,
"type": "object", "type": "object",
"required": [
"enabled",
"googleConsent",
"conversionId",
"conversion",
"remarketing"
]
},
"GoogleAdsConversion": {
"properties": { "properties": {
"enabled": {
"type": "boolean"
},
"conversionLabel": {
"type": "string"
},
"serverContainer": {
"$ref": "#/$defs/Config"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"enabled",
"conversionLabel",
"serverContainer"
]
},
"GoogleAdsRemarketing": {
"properties": {
"enabled": {
"type": "boolean"
},
"enableConversionLinker": {
"type": "boolean"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"enabled",
"enableConversionLinker"
]
},
"GoogleAnalytics": {
"properties": {
"enabled": {
"type": "boolean"
},
"googleGTag": {
"$ref": "#/$defs/GoogleGTag"
},
"googleConsent": {
"$ref": "#/$defs/GoogleConsent"
},
"webContainer": {
"$ref": "#/$defs/Config"
},
"serverContainer": {
"$ref": "#/$defs/Config"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"enabled",
"googleGTag",
"googleConsent",
"webContainer",
"serverContainer"
]
},
"GoogleConsent": {
"properties": {
"enabled": {
"type": "boolean"
},
"mode": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"enabled",
"mode"
]
},
"GoogleGTag": {
"properties": {
"enabled": {
"type": "boolean"
},
"priority": {
"type": "integer"
},
"ecommerceItems": {
"type": "boolean"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"enabled",
"priority",
"ecommerceItems"
]
},
"GoogleTag": {
"properties": {
"tagId": {
"type": "string"
},
"debugMode": { "debugMode": {
"type": "boolean" "type": "boolean"
}, },
"sendPageView": { "sendPageView": {
"type": "boolean" "type": "boolean"
}, },
"serverContainer": {
"type": "object",
"properties": {
"packages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"types": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"tagId": {
"type": "string"
},
"typeScript": { "typeScript": {
"type": "object", "$ref": "#/$defs/TypeScript"
"properties": {
"outputPath": {
"type": "string"
},
"packages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"types": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
} }
}, },
"webContainer": { "additionalProperties": false,
"type": "object", "type": "object",
"properties": { "required": [
"packages": { "tagId",
"type": "array", "debugMode",
"items": { "sendPageView",
"type": "object", "typeScript"
"properties": { ]
"path": {
"type": "string"
}, },
"types": { "GoogleTagManager": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
},
"googleTagManager": {
"type": "object",
"properties": { "properties": {
"accountId": { "accountId": {
"type": "integer"
},
"serverContainer": {
"type": "object",
"properties": {
"containerId": {
"type": "integer"
},
"tagId": {
"type": "string" "type": "string"
}, },
"workspaceId": {
"type": "integer"
}
}
},
"webContainer": { "webContainer": {
"type": "object", "$ref": "#/$defs/GoogleTagManagerContainer"
"properties": {
"containerId": {
"type": "integer"
}, },
"serverContainer": {
"$ref": "#/$defs/GoogleTagManagerContainer"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"accountId",
"webContainer",
"serverContainer"
]
},
"GoogleTagManagerContainer": {
"properties": {
"tagId": { "tagId": {
"type": "string" "type": "string"
}, },
"containerId": {
"type": "string"
},
"workspaceId": { "workspaceId": {
"type": "integer"
}
}
}
}
},
"redactVisitorIp": {
"type": "boolean"
},
"tracify": {
"type": "object",
"properties": {
"customerSiteId": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"googleConsent": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"mode": {
"type": "string" "type": "string"
} }
}
}, },
"serverContainer": { "additionalProperties": false,
"type": "object",
"properties": {
"packages": {
"type": "array",
"items": {
"type": "object", "type": "object",
"required": [
"tagId",
"containerId",
"workspaceId"
]
},
"PackageConfig": {
"properties": { "properties": {
"path": { "path": {
"type": "string" "type": "string"
}, },
"types": { "types": {
"type": "array",
"items": { "items": {
"type": "string" "type": "string"
},
"type": "array"
} }
} },
} "additionalProperties": false,
} "type": "object",
} "required": [
} "path",
"types"
]
},
"Tracify": {
"properties": {
"enabled": {
"type": "boolean"
}, },
"token": { "token": {
"type": "string" "type": "string"
} },
"customerSiteId": {
"type": "string"
},
"googleConsent": {
"$ref": "#/$defs/GoogleConsent"
},
"serverContainer": {
"$ref": "#/$defs/Config"
} }
}, },
"umami": { "additionalProperties": false,
"type": "object", "type": "object",
"required": [
"enabled",
"token",
"customerSiteId",
"googleConsent",
"serverContainer"
]
},
"TypeScript": {
"properties": { "properties": {
"packages": {
"items": {
"$ref": "#/$defs/PackageConfig"
},
"type": "array"
},
"outputPath": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"packages",
"outputPath"
]
},
"Umami": {
"properties": {
"enabled": {
"type": "boolean"
},
"domain": { "domain": {
"type": "string" "type": "string"
}, },
"enabled": { "websiteId": {
"type": "boolean" "type": "string"
}, },
"endpointUrl": { "endpointUrl": {
"type": "string" "type": "string"
}, },
"googleConsent": { "googleConsent": {
"type": "object", "$ref": "#/$defs/GoogleConsent"
"properties": {
"enabled": {
"type": "boolean"
},
"mode": {
"type": "string"
}
}
}, },
"serverContainer": { "serverContainer": {
"$ref": "#/$defs/Config"
}
},
"additionalProperties": false,
"type": "object", "type": "object",
"properties": { "required": [
"packages": { "enabled",
"type": "array", "domain",
"items": { "websiteId",
"type": "object", "endpointUrl",
"properties": { "googleConsent",
"path": { "serverContainer"
"type": "string" ]
},
"types": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"websiteId": {
"type": "string"
}
}
},
"version": {
"type": "string"
} }
} }
} }