initial
This commit is contained in:
commit
b115f308c3
26 changed files with 1120 additions and 0 deletions
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# pybuilder
|
||||||
|
.pybuilder/
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
|
# lein
|
||||||
|
target/
|
||||||
|
.lein-repl-history
|
||||||
|
.lein-failures
|
||||||
|
pom.*
|
||||||
|
|
||||||
|
# cljs
|
||||||
|
.shadow-cljs
|
||||||
|
.nrepl-*
|
||||||
|
package-lock.json
|
||||||
|
node_modules/
|
||||||
|
public/js/
|
||||||
|
|
||||||
|
# ide
|
||||||
|
.calva
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
myauth.edn
|
||||||
|
myconfig.edn
|
112
.gitlab-ci.yml
Normal file
112
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
stages:
|
||||||
|
- first
|
||||||
|
- build_and_test
|
||||||
|
- package
|
||||||
|
- security
|
||||||
|
- upload
|
||||||
|
|
||||||
|
.cljs-job: &cljs
|
||||||
|
image: domaindrivenarchitecture/shadow-cljs
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
- .shadow-cljs/
|
||||||
|
- .m2
|
||||||
|
before_script:
|
||||||
|
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
||||||
|
- npm install
|
||||||
|
|
||||||
|
.clj-uploadjob: &clj
|
||||||
|
image: clojure:lein-2.7.1-alpine
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- .m2
|
||||||
|
before_script:
|
||||||
|
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_PASSWORD}\" }}}}" > ~/.lein/profiles.clj
|
||||||
|
|
||||||
|
test-cljs:
|
||||||
|
<<: *cljs
|
||||||
|
stage: build_and_test
|
||||||
|
script:
|
||||||
|
- shadow-cljs compile test
|
||||||
|
|
||||||
|
test-clj:
|
||||||
|
<<: *clj
|
||||||
|
stage: build_and_test
|
||||||
|
script:
|
||||||
|
- lein test
|
||||||
|
|
||||||
|
report-frontend:
|
||||||
|
<<: *cljs
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- mkdir -p target/frontend-build
|
||||||
|
- shadow-cljs run shadow.cljs.build-report frontend target/frontend-build/build-report.html
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/frontend-build/build-report.html
|
||||||
|
|
||||||
|
package-frontend:
|
||||||
|
<<: *cljs
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- mkdir -p target/frontend-build
|
||||||
|
- shadow-cljs release frontend
|
||||||
|
- cp public/js/main.js target/frontend-build/k8s-keycloak.js
|
||||||
|
- sha256sum target/frontend-build/k8s-keycloak.js > target/frontend-build/k8s-keycloak.js.sha256
|
||||||
|
- sha512sum target/frontend-build/k8s-keycloak.js > target/frontend-build/k8s-keycloak.js.sha512
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/frontend-build
|
||||||
|
|
||||||
|
package-uberjar:
|
||||||
|
<<: *clj
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- lein uberjar
|
||||||
|
- sha256sum target/uberjar/k8s-keycloak-standalone.jar > target/uberjar/k8s-keycloak-standalone.jar.sha256
|
||||||
|
- sha512sum target/uberjar/k8s-keycloak-standalone.jar > target/uberjar/k8s-keycloak-standalone.jar.sha512
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/uberjar
|
||||||
|
|
||||||
|
sast:
|
||||||
|
variables:
|
||||||
|
SAST_EXCLUDED_ANALYZERS:
|
||||||
|
bandit, brakeman, flawfinder, gosec, kubesec, phpcs-security-audit,
|
||||||
|
pmd-apex, security-code-scan, sobelow, spotbugs
|
||||||
|
stage: security
|
||||||
|
before_script:
|
||||||
|
- mkdir -p builds && cp -r target/ builds/
|
||||||
|
include:
|
||||||
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
|
|
||||||
|
upload-clj-prerelease:
|
||||||
|
<<: *clj
|
||||||
|
stage: upload
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
|
||||||
|
script:
|
||||||
|
- lein deploy clojars
|
||||||
|
|
||||||
|
release:
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
stage: upload
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_TAG != null'
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/uberjar
|
||||||
|
- target/frontend-build
|
||||||
|
script:
|
||||||
|
- apk --no-cache add curl
|
||||||
|
- |
|
||||||
|
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
||||||
|
--assets-link "{\"name\":\"k8s-keycloak-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/k8s-keycloak-standalone.jar\"}" \
|
||||||
|
--assets-link "{\"name\":\"k8s-keycloak-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/k8s-keycloak-standalone.jar.sha256\"}" \
|
||||||
|
--assets-link "{\"name\":\"k8s-keycloak-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/k8s-keycloak-standalone.jar.sha512\"}" \
|
||||||
|
--assets-link "{\"name\":\"k8s-keycloak.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/k8s-keycloak.js\"}" \
|
||||||
|
--assets-link "{\"name\":\"k8s-keycloak.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/k8s-keycloak.js.sha256\"}" \
|
||||||
|
--assets-link "{\"name\":\"k8s-keycloak.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/k8s-keycloak.js.sha512\"}" \
|
40
README.md
Normal file
40
README.md
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
# k8s-keycloak
|
||||||
|
[![Clojars Project](https://img.shields.io/clojars/v/dda/k8s-keycloak.svg)](https://clojars.org/dda/k8s-keycloak) [![pipeline status](https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/badges/master/pipeline.svg)](https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/-/commits/master)
|
||||||
|
|
||||||
|
[<img src="https://domaindrivenarchitecture.org/img/delta-chat.svg" width=20 alt="DeltaChat"> chat over e-mail](mailto:buero@meissa-gmbh.de?subject=community-chat) | [<img src="https://meissa-gmbh.de/img/community/Mastodon_Logotype.svg" width=20 alt="team@social.meissa-gmbh.de"> team@social.meissa-gmbh.de](https://social.meissa-gmbh.de/@team) | [Website & Blog](https://domaindrivenarchitecture.org)
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
k8s-keycloak ....
|
||||||
|
|
||||||
|
## Rational
|
||||||
|
|
||||||
|
There are many comparable solutions for creating k8s deployments like helm or kustomize. Why do we need another one?
|
||||||
|
* We like the simplicity of kustomize. Yaml in, yaml out, the ability to lint the result and the option to split large yaml files into objects. But a simple overwriting per environment may not be enough ...
|
||||||
|
* We like helm packages. A package encapsulates the setup for an application. On the one hand, but on the other hand we don't like the idea of having to program and debug in a template language. We can program much better in real programming languages.
|
||||||
|
|
||||||
|
Our k8s-* tools combine the advantages of both approaches:
|
||||||
|
* Packages for one application
|
||||||
|
* Programming in clojure
|
||||||
|
* yaml / edn as input and output, no more magic
|
||||||
|
* good validation, integration as api, cli or in the browser
|
||||||
|
|
||||||
|
## Try out
|
||||||
|
|
||||||
|
Click on the image to try out live in your browser:
|
||||||
|
|
||||||
|
[![Try it out](/doc/tryItOut.png "Try out yourself")](https://domaindrivenarchitecture.org/pages/dda-provision/k8s-keycloak/)
|
||||||
|
|
||||||
|
Your input will stay in your browser. No server interaction is required.
|
||||||
|
|
||||||
|
You will also be able to try out on cli:
|
||||||
|
```
|
||||||
|
target/graalvm/k8s-keycloak src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubeval -
|
||||||
|
target/graalvm/k8s-keycloak src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubectl apply -f -
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright © 2021 meissa GmbH
|
||||||
|
Licensed under the [Apache License, Version 2.0](LICENSE) (the "License")
|
||||||
|
Pls. find licenses of our subcomponents [here](doc/SUBCOMPONENT_LICENSE)
|
98
doc/Developement.md
Normal file
98
doc/Developement.md
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
# Project Setup
|
||||||
|
|
||||||
|
## clj setup
|
||||||
|
|
||||||
|
## cljs / js-dev setup
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install npm
|
||||||
|
sudo npm install -g npx
|
||||||
|
|
||||||
|
# maybe
|
||||||
|
sudo npm install -g shadow-cljs
|
||||||
|
|
||||||
|
# in project root to retrieve all dependencies
|
||||||
|
npm install --ignore-scripts
|
||||||
|
npx shadow-cljs compile test
|
||||||
|
```
|
||||||
|
|
||||||
|
### create frontend script
|
||||||
|
|
||||||
|
```
|
||||||
|
npx shadow-cljs release frontend
|
||||||
|
```
|
||||||
|
|
||||||
|
## graalvm-setup
|
||||||
|
|
||||||
|
```
|
||||||
|
curl -LO https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.0.0.2/graalvm-ce-java11-linux-amd64-21.0.0.2.tar.gz
|
||||||
|
|
||||||
|
# unpack
|
||||||
|
tar -xzf graalvm-ce-java11-linux-amd64-21.0.0.2.tar.gz
|
||||||
|
|
||||||
|
sudo mv graalvm-ce-java11-21.0.0.2 /usr/lib/jvm/
|
||||||
|
sudo ln -s /usr/lib/jvm/graalvm-ce-java11-21.0.0.2 /usr/lib/jvm/graalvm
|
||||||
|
sudo ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin
|
||||||
|
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2
|
||||||
|
sudo update-alternatives --config java
|
||||||
|
|
||||||
|
# install native-image in graalvm-ce-java11-linux-amd64-21.0.0.2/bin
|
||||||
|
sudo gu install native-image
|
||||||
|
sudo ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin
|
||||||
|
|
||||||
|
# deps
|
||||||
|
sudo apt-get install build-essential libz-dev zlib1g-dev
|
||||||
|
|
||||||
|
# build
|
||||||
|
cd ~/repo/dda/k8s-keycloak
|
||||||
|
lein uberjar
|
||||||
|
mkdir -p target/graalvm
|
||||||
|
lein native
|
||||||
|
|
||||||
|
# execute
|
||||||
|
./target/graalvm/k8s-keycloak -h
|
||||||
|
./target/graalvm/k8s-keycloak src/test/resources/valid-config.edn src/test/resources/valid-auth.edn
|
||||||
|
./target/graalvm/k8s-keycloak src/test/resources/invalid-config.edn src/test/resources/invalid-auth.edn
|
||||||
|
```
|
||||||
|
|
||||||
|
## k8s-setup
|
||||||
|
### install kubectl
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -i
|
||||||
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
|
||||||
|
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" \
|
||||||
|
| tee -a /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
apt update && apt install kubectl
|
||||||
|
kubectl completion bash >> /etc/bash_completion.d/kubernetes
|
||||||
|
```
|
||||||
|
|
||||||
|
### install kubeval
|
||||||
|
|
||||||
|
```
|
||||||
|
wget https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz
|
||||||
|
tar xf kubeval-linux-amd64.tar.gz
|
||||||
|
sudo cp kubeval /usr/local/bin
|
||||||
|
|
||||||
|
## remote access to k8s
|
||||||
|
```
|
||||||
|
|
||||||
|
### remote access to k8s
|
||||||
|
|
||||||
|
```
|
||||||
|
scp -r root@devops.test.meissa-gmbh.de:/home/k8s/.kube ~/
|
||||||
|
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@devops.test.meissa-gmbh.de -L 8002:localhost:8002 -L 6443:192.168.5.1:6443
|
||||||
|
|
||||||
|
# add in /etc/hosts "127.0.0.1 kubernetes"
|
||||||
|
|
||||||
|
# change in ~/.kube/config 192.168.5.1 -> kubernetes
|
||||||
|
|
||||||
|
kubectl get pods
|
||||||
|
```
|
||||||
|
|
||||||
|
### deploy keycloak
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar target/uberjar/k8s-keycloak-standalone.jar myconfig.edn myauth.edn | kubeval -
|
||||||
|
java -jar target/uberjar/k8s-keycloak-standalone.jar myconfig.edn myauth.edn | kubectl apply -f -
|
||||||
|
```
|
14
doc/Releasing.md
Normal file
14
doc/Releasing.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# stable release (should be done from master)
|
||||||
|
|
||||||
|
```
|
||||||
|
#adjust [version]
|
||||||
|
vi package.json
|
||||||
|
|
||||||
|
lein release
|
||||||
|
git push --follow-tags
|
||||||
|
|
||||||
|
# bump version - increase version and add -SNAPSHOT
|
||||||
|
vi package.json
|
||||||
|
git commit -am "version bump"
|
||||||
|
git push
|
||||||
|
```
|
206
doc/SUBCOMPONENT_LICENSE
Normal file
206
doc/SUBCOMPONENT_LICENSE
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
SUBCOMPONENTS:
|
||||||
|
|
||||||
|
This Software includes a number of subcomponents with
|
||||||
|
separate copyright notices and license terms. Your use of the source
|
||||||
|
code for the these subcomponents is subject to the terms and
|
||||||
|
conditions of the following licenses.
|
||||||
|
|
||||||
|
lein with-profile uberjar licenses
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Eclipse Public License, Version 1.0 (EPL-1.0)
|
||||||
|
|
||||||
|
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||||
|
|
||||||
|
1. DEFINITIONS
|
||||||
|
|
||||||
|
"Contribution" means:
|
||||||
|
|
||||||
|
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
|
||||||
|
b) in the case of each subsequent Contributor:
|
||||||
|
i) changes to the Program, and
|
||||||
|
ii) additions to the Program;
|
||||||
|
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
|
||||||
|
|
||||||
|
"Contributor" means any person or entity that distributes the Program.
|
||||||
|
|
||||||
|
"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
|
||||||
|
|
||||||
|
"Program" means the Contributions distributed in accordance with this Agreement.
|
||||||
|
|
||||||
|
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
|
||||||
|
|
||||||
|
2. GRANT OF RIGHTS
|
||||||
|
|
||||||
|
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
|
||||||
|
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
|
||||||
|
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
|
||||||
|
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
|
||||||
|
|
||||||
|
3. REQUIREMENTS
|
||||||
|
|
||||||
|
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
|
||||||
|
|
||||||
|
a) it complies with the terms and conditions of this Agreement; and
|
||||||
|
b) its license agreement:
|
||||||
|
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
|
||||||
|
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
|
||||||
|
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
|
||||||
|
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
|
||||||
|
|
||||||
|
When the Program is made available in source code form:
|
||||||
|
|
||||||
|
a) it must be made available under this Agreement; and
|
||||||
|
b) a copy of this Agreement must be included with each copy of the Program.
|
||||||
|
|
||||||
|
Contributors may not remove or alter any copyright notices contained within the Program.
|
||||||
|
|
||||||
|
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
|
||||||
|
|
||||||
|
4. COMMERCIAL DISTRIBUTION
|
||||||
|
|
||||||
|
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
|
||||||
|
|
||||||
|
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
|
||||||
|
|
||||||
|
5. NO WARRANTY
|
||||||
|
|
||||||
|
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
|
||||||
|
|
||||||
|
6. DISCLAIMER OF LIABILITY
|
||||||
|
|
||||||
|
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
7. GENERAL
|
||||||
|
|
||||||
|
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
|
||||||
|
|
||||||
|
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||||
|
|
||||||
|
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
|
||||||
|
|
||||||
|
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright © 2015 Stuart Sierra
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
The BSD 3-Clause License The following is a BSD 3-Clause ("BSD New" or "BSD Simplified") license template. To generate your own license, change the values of OWNER, ORGANIZATION and YEAR from their original values as given here, and substitute your own.
|
||||||
|
|
||||||
|
Note: You may omit clause 3 and still be OSD-conformant. Despite its colloquial name "BSD New", this is not the newest version of the BSD license; it was followed by the even newer BSD-2-Clause version, sometimes known as the "Simplified BSD License". On January 9th, 2008 the OSI Board approved BSD-2-Clause, which is used by FreeBSD and others. It omits the final "no-endorsement" clause and is thus roughly equivalent to the MIT License.
|
||||||
|
|
||||||
|
Historical Background: The original license used on BSD Unix had four clauses. The advertising clause (the third of four clauses) required you to acknowledge use of U.C. Berkeley code in your advertising of any product using that code. It was officially rescinded by the Director of the Office of Technology Licensing of the University of California on July 22nd, 1999. He states that clause 3 is "hereby deleted in its entirety." The four clause license has not been approved by OSI. The license below does not contain the advertising clause.
|
||||||
|
|
||||||
|
This prelude is not part of the license.
|
||||||
|
|
||||||
|
OWNER = Regents of the University of California
|
||||||
|
|
||||||
|
ORGANIZATION = University of California, Berkeley
|
||||||
|
|
||||||
|
YEAR = 1998
|
||||||
|
|
||||||
|
In the original BSD license, both occurrences of the phrase "COPYRIGHT HOLDERS AND CONTRIBUTORS" in the disclaimer read "REGENTS AND CONTRIBUTORS".
|
||||||
|
License template
|
||||||
|
|
||||||
|
Copyright (c) $YEAR $OWNER, All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
|
||||||
|
|
||||||
|
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
|
||||||
|
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
|
||||||
|
d) Do one of the following:
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
|
||||||
|
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
|
||||||
|
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
|
||||||
|
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
|
||||||
|
Copyright (c) 2000 - 2018 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7
image/Dockerfile
Normal file
7
image/Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FROM node:lts-slim
|
||||||
|
|
||||||
|
RUN npm install -g keycloak
|
||||||
|
RUN mkdir /app
|
||||||
|
|
||||||
|
ENTRYPOINT ["keycloak"]
|
||||||
|
CMD [ "/app/config.edn" ]
|
30
package.json
Normal file
30
package.json
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "k8s-keycloak",
|
||||||
|
"description": "Generate k8s yaml for a keycloak deployment.",
|
||||||
|
"author": "meissa GmbH",
|
||||||
|
"version": "0.1.5-SNAPSHOT",
|
||||||
|
"homepage": "https://gitlab.com/domaindrivenarchitecture/k8s-keycloak#readme",
|
||||||
|
"repository": "https://www.npmjs.com/package/k8s-keycloak",
|
||||||
|
"license": "APACHE2",
|
||||||
|
"main": "k8s-keycloak.js",
|
||||||
|
"bin": {
|
||||||
|
"k8s-keycloak": "./k8s-keycloak.js"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"cljs",
|
||||||
|
"keycloak",
|
||||||
|
"k8s",
|
||||||
|
"deplyoment",
|
||||||
|
"yaml"
|
||||||
|
],
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"js-yaml": "^4.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"shadow-cljs": "^2.11.18",
|
||||||
|
"source-map-support": "^0.5.19"
|
||||||
|
}
|
||||||
|
}
|
44
project.clj
Normal file
44
project.clj
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
(defproject dda/k8s-keycloak "0.1.0-SNAPSHOT"
|
||||||
|
:description "common utils for dda config"
|
||||||
|
:url "https://www.domaindrivenarchitecture.org"
|
||||||
|
:license {:name "Apache License, Version 2.0"
|
||||||
|
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||||
|
:dependencies [[org.clojure/clojure "1.10.3"]
|
||||||
|
[org.clojure/tools.reader "1.3.4"]
|
||||||
|
[aero "1.1.6"]
|
||||||
|
[orchestra "2021.01.01-1"]
|
||||||
|
[expound "0.8.9"]
|
||||||
|
[clj-commons/clj-yaml "0.7.106"]]
|
||||||
|
:target-path "target/%s/"
|
||||||
|
:source-paths ["src/main/cljc"
|
||||||
|
"src/main/clj"]
|
||||||
|
:resource-paths ["src/main/resources"]
|
||||||
|
:repositories [["snapshots" :clojars]
|
||||||
|
["releases" :clojars]]
|
||||||
|
:deploy-repositories [["snapshots" :clojars]
|
||||||
|
["releases" :clojars]]
|
||||||
|
:profiles {:test {:test-paths ["src/test/cljc"]
|
||||||
|
:resource-paths ["src/test/resources"]
|
||||||
|
:dependencies [[dda/data-test "0.1.1"]]}
|
||||||
|
:dev {:plugins [[lein-shell "0.5.0"]]}
|
||||||
|
:uberjar {:aot :all
|
||||||
|
:main dda.k8s-keycloak.uberjar
|
||||||
|
:uberjar-name "k8s-keycloak-standalone.jar"
|
||||||
|
:dependencies [[org.clojure/tools.cli "1.0.206"]
|
||||||
|
[ch.qos.logback/logback-classic "1.3.0-alpha4"
|
||||||
|
:exclusions [com.sun.mail/javax.mail]]
|
||||||
|
[org.slf4j/jcl-over-slf4j "2.0.0-alpha1"]]}}
|
||||||
|
:release-tasks [["vcs" "assert-committed"]
|
||||||
|
["change" "version" "leiningen.release/bump-version" "release"]
|
||||||
|
["vcs" "commit"]
|
||||||
|
["vcs" "tag"]
|
||||||
|
["deploy"]
|
||||||
|
["change" "version" "leiningen.release/bump-version"]]
|
||||||
|
:aliases {"native" ["shell"
|
||||||
|
"native-image"
|
||||||
|
"--report-unsupported-elements-at-runtime"
|
||||||
|
"--initialize-at-build-time"
|
||||||
|
"-jar" "target/uberjar/k8s-keycloak-standalone.jar"
|
||||||
|
"-H:ResourceConfigurationFiles=graalvm-resource-config.json"
|
||||||
|
"-H:Log=registerResource"
|
||||||
|
"-H:Name=target/graalvm/${:name}"]})
|
80
public/index.html
Normal file
80
public/index.html
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>k8s-mastodon-bot</title>
|
||||||
|
<link href="https://domaindrivenarchitecture.org/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="https://domaindrivenarchitecture.org/css/fonts/fontawesome/fontawesome.css" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="https://domaindrivenarchitecture.org/css/custom.css" rel="stylesheet" type="text/css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container jumbotron">
|
||||||
|
<form class="needs-validation" id="form">
|
||||||
|
<label for="config" class="form-label">Your config.edn:</label>
|
||||||
|
<textarea name="config" id="config" class="form-control" rows="15">
|
||||||
|
{:transform [{:source {:source-type :twitter
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-replies? false
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-rts? false
|
||||||
|
;; Replace Twitter links by Nitter
|
||||||
|
:nitter-urls? false
|
||||||
|
;; accounts you wish to mirror
|
||||||
|
:accounts ["arstechnica" "WIRED"]}
|
||||||
|
:target {:target-type :mastodon
|
||||||
|
;; optional flag specifying wether the name of the account
|
||||||
|
;; will be appended in the post, defaults to false
|
||||||
|
:append-screen-name? false
|
||||||
|
;; optional visibility flag: direct, private, unlisted, public
|
||||||
|
;; defaults to public
|
||||||
|
:visibility "unlisted"
|
||||||
|
;; optional boolean to mark content as sensitive. Defaults to true.
|
||||||
|
:sensitive? true
|
||||||
|
;; optional boolean defaults to false
|
||||||
|
;; only sources containing media will be posted when set to true
|
||||||
|
:media-only? true
|
||||||
|
;; optional limit for the post length. Defaults to 300.
|
||||||
|
:max-post-length 300
|
||||||
|
;; optional signature for posts. Defaults to "not present".
|
||||||
|
:signature "#newsbot"}
|
||||||
|
}]
|
||||||
|
:auth {}}}
|
||||||
|
</textarea>
|
||||||
|
<div class="invalid-feedback"><pre id="config-validation"></pre></div>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<label for="auth" class="form-label">Your auth.edn:</label>
|
||||||
|
<textarea name="auth" id="auth" class="form-control" rows="15">
|
||||||
|
{:auth {;; add Twitter config to mirror Twitter accounts
|
||||||
|
:twitter {:consumer_key "XXXX"
|
||||||
|
:consumer_secret "XXXX"
|
||||||
|
:access_token_key "XXXX"
|
||||||
|
:access_token_secret "XXXX"}
|
||||||
|
:mastodon {:access_token "XXXX"
|
||||||
|
;; account number you see when you log in and go to your profile
|
||||||
|
;; e.g: https://mastodon.social/web/accounts/294795
|
||||||
|
:account-id "XXXX"
|
||||||
|
:api_url "https://botsin.space/api/v1/"}
|
||||||
|
:tumblr {:consumer_key "XXXX"
|
||||||
|
:consumer_secret "XXXX"
|
||||||
|
:token "XXXX"
|
||||||
|
:token_secret "XXXX"}}}
|
||||||
|
</textarea>
|
||||||
|
<div class="invalid-feedback"><pre id="auth-validation"></pre></div>
|
||||||
|
<br><br>
|
||||||
|
<button type="button" id="generate-button" class="btn btn-primary">
|
||||||
|
Generate k8s yaml
|
||||||
|
</button></form><br><br>
|
||||||
|
<div id="k8s-mastodon-bot-output">
|
||||||
|
<label for="output" class="form-label">Your k8s deployment.yaml:</label>
|
||||||
|
<textarea name="output" id="output" class="form-control" rows="15">
|
||||||
|
</textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="js/main.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
16
shadow-cljs.edn
Normal file
16
shadow-cljs.edn
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{:source-paths ["src/main/cljc"
|
||||||
|
"src/main/cljs"
|
||||||
|
"src/main/resources"
|
||||||
|
"src/test/cljc"]
|
||||||
|
:dependencies [[aero "1.1.6"]
|
||||||
|
[orchestra "2021.01.01-1"]
|
||||||
|
[expound "0.8.9"]]
|
||||||
|
:dev-http {8080 "public"}
|
||||||
|
:builds {:frontend {:target :browser
|
||||||
|
:modules {:main {:init-fn dda.k8s-keycloak.browser/init}}
|
||||||
|
:release {}
|
||||||
|
:compiler-options {:optimizations :advanced}}
|
||||||
|
:test {:target :node-test
|
||||||
|
:output-to "target/node-tests.js"
|
||||||
|
:autorun true
|
||||||
|
:repl-pprint true}}}
|
56
src/main/clj/dda/k8s_keycloak/uberjar.clj
Normal file
56
src/main/clj/dda/k8s_keycloak/uberjar.clj
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
(ns dda.k8s-keycloak.uberjar
|
||||||
|
(:gen-class)
|
||||||
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[clojure.string :as cs]
|
||||||
|
[clojure.tools.reader.edn :as edn]
|
||||||
|
[expound.alpha :as expound]
|
||||||
|
[dda.k8s-keycloak.core :as core]))
|
||||||
|
|
||||||
|
(def usage
|
||||||
|
"usage:
|
||||||
|
|
||||||
|
k8s-keycloak {your configuraton file} {your authorization file}")
|
||||||
|
|
||||||
|
(s/def ::options (s/* #{"-h"}))
|
||||||
|
(s/def ::filename (s/and string?
|
||||||
|
#(not (cs/starts-with? % "-"))))
|
||||||
|
(s/def ::cmd-args (s/cat :options ::options
|
||||||
|
:args (s/?
|
||||||
|
(s/cat :config ::filename
|
||||||
|
:auth ::filename))))
|
||||||
|
|
||||||
|
(defn expound-config
|
||||||
|
[config]
|
||||||
|
(expound/expound ::core/config config))
|
||||||
|
|
||||||
|
(defn invalid-args-msg
|
||||||
|
[spec args]
|
||||||
|
(s/explain spec args)
|
||||||
|
(println (str "Bad commandline arguments\n" usage)))
|
||||||
|
|
||||||
|
(defn -main [& cmd-args]
|
||||||
|
(let [parsed-args-cmd (s/conform ::cmd-args cmd-args)]
|
||||||
|
(if (= ::s/invalid parsed-args-cmd)
|
||||||
|
(invalid-args-msg ::cmd-args cmd-args)
|
||||||
|
(let [{:keys [options args]} parsed-args-cmd
|
||||||
|
{:keys [config auth]} args]
|
||||||
|
(cond
|
||||||
|
(some #(= "-h" %) options)
|
||||||
|
(println usage)
|
||||||
|
:default
|
||||||
|
(let [config-str (slurp (:config args))
|
||||||
|
auth-str (slurp (:auth args))
|
||||||
|
config-edn (edn/read-string config-str)
|
||||||
|
auth-edn (edn/read-string auth-str)
|
||||||
|
config-valid? (s/valid? core/config? config-edn)
|
||||||
|
auth-valid? (s/valid? core/auth? auth-edn)]
|
||||||
|
(if (and config-valid? auth-valid?)
|
||||||
|
(println (core/generate config-str auth-str))
|
||||||
|
(do
|
||||||
|
(when (not config-valid?)
|
||||||
|
(println
|
||||||
|
(expound/expound-str core/config? config-edn {:print-specs? false})))
|
||||||
|
(when (not auth-valid?)
|
||||||
|
(println
|
||||||
|
(expound/expound-str core/auth? auth-edn {:print-specs? false})))))))))))
|
13
src/main/clj/dda/k8s_keycloak/yaml.clj
Normal file
13
src/main/clj/dda/k8s_keycloak/yaml.clj
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
(ns dda.k8s-keycloak.yaml
|
||||||
|
(:require
|
||||||
|
[clojure.java.io :as io]
|
||||||
|
[clj-yaml.core :as yaml]))
|
||||||
|
|
||||||
|
(defn load-resource [resource-name]
|
||||||
|
(slurp (io/resource resource-name)))
|
||||||
|
|
||||||
|
(defn from-string [input]
|
||||||
|
(yaml/parse-string input))
|
||||||
|
|
||||||
|
(defn to-string [edn]
|
||||||
|
(yaml/generate-string edn :dumper-options {:flow-style :block}))
|
33
src/main/cljc/dda/k8s_keycloak/core.cljc
Normal file
33
src/main/cljc/dda/k8s_keycloak/core.cljc
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
(ns dda.k8s-keycloak.core
|
||||||
|
(:require
|
||||||
|
[clojure.string :as cs]
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
#?(:clj [orchestra.core :refer [defn-spec]]
|
||||||
|
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||||
|
[keycloak.core-domain :as cd]
|
||||||
|
[dda.k8s-keycloak.yaml :as yaml]))
|
||||||
|
|
||||||
|
(def config? cd/config?)
|
||||||
|
|
||||||
|
(def auth? (s/keys :req-un [::cd/auth]))
|
||||||
|
|
||||||
|
(defn generate-config [my-config my-auth]
|
||||||
|
(->
|
||||||
|
(yaml/from-string (yaml/load-resource "config.yaml"))
|
||||||
|
(assoc-in [:data :config.edn] (str my-config))
|
||||||
|
(assoc-in [ :data :credentials.edn] (str my-auth))
|
||||||
|
))
|
||||||
|
|
||||||
|
(defn generate-deployment []
|
||||||
|
(yaml/from-string (yaml/load-resource "deployment.yaml")))
|
||||||
|
|
||||||
|
(defn generate-cron []
|
||||||
|
(yaml/from-string (yaml/load-resource "cron.yaml")))
|
||||||
|
|
||||||
|
(defn-spec generate any?
|
||||||
|
[my-config string?
|
||||||
|
my-auth string?]
|
||||||
|
(cs/join "\n"
|
||||||
|
[(yaml/to-string (generate-config my-config my-auth))
|
||||||
|
"---"
|
||||||
|
(yaml/to-string (generate-cron))]))
|
99
src/main/cljs/dda/k8s_keycloak/browser.cljs
Normal file
99
src/main/cljs/dda/k8s_keycloak/browser.cljs
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
(ns dda.k8s-keycloak.browser
|
||||||
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[clojure.tools.reader.edn :as edn]
|
||||||
|
[expound.alpha :as expound]
|
||||||
|
[dda.k8s-keycloak.core :as core]))
|
||||||
|
|
||||||
|
(defn print-debug [sth]
|
||||||
|
(print "debug " sth)
|
||||||
|
sth)
|
||||||
|
|
||||||
|
(defn config []
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById "config")))
|
||||||
|
|
||||||
|
(defn auth []
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById "auth")))
|
||||||
|
|
||||||
|
(defn form []
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById "form")))
|
||||||
|
|
||||||
|
(defn config-from-document []
|
||||||
|
(-> (config)
|
||||||
|
(.-value)))
|
||||||
|
|
||||||
|
(defn auth-from-document []
|
||||||
|
(-> (auth)
|
||||||
|
(.-value)))
|
||||||
|
|
||||||
|
(defn set-output!
|
||||||
|
[input]
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById "output")
|
||||||
|
(.-value)
|
||||||
|
(set! input)))
|
||||||
|
|
||||||
|
(defn set-config-validation-result!
|
||||||
|
[validation-result]
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById "config-validation")
|
||||||
|
(.-innerHTML)
|
||||||
|
(set! validation-result))
|
||||||
|
(-> (config)
|
||||||
|
(.setCustomValidity validation-result))
|
||||||
|
validation-result)
|
||||||
|
|
||||||
|
(defn validate-config! []
|
||||||
|
(let [config-str (config-from-document)
|
||||||
|
config-map (edn/read-string config-str)]
|
||||||
|
(if (s/valid? core/config? config-map)
|
||||||
|
(set-config-validation-result! "")
|
||||||
|
(set-config-validation-result!
|
||||||
|
(expound/expound-str core/config? config-map {:print-specs? false})))))
|
||||||
|
|
||||||
|
(defn set-validated! []
|
||||||
|
(-> (form)
|
||||||
|
(.-classList)
|
||||||
|
(.add "was-validated")))
|
||||||
|
|
||||||
|
(defn set-auth-validation-result!
|
||||||
|
[validation-result]
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById "auth-validation")
|
||||||
|
(.-innerHTML)
|
||||||
|
(set! validation-result))
|
||||||
|
(-> (auth)
|
||||||
|
(.setCustomValidity validation-result))
|
||||||
|
validation-result)
|
||||||
|
|
||||||
|
(defn validate-auth! []
|
||||||
|
(let [auth-str (auth-from-document)
|
||||||
|
auth-map (edn/read-string auth-str)]
|
||||||
|
(print-debug (s/valid? core/auth? auth-map))
|
||||||
|
(if (s/valid? core/auth? auth-map)
|
||||||
|
(set-auth-validation-result! "")
|
||||||
|
(set-auth-validation-result!
|
||||||
|
(expound/expound-str core/auth? auth-map {:print-specs? false})))))
|
||||||
|
|
||||||
|
(defn init []
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById "generate-button")
|
||||||
|
(.addEventListener "click"
|
||||||
|
#(do (validate-config!)
|
||||||
|
(validate-auth!)
|
||||||
|
(set-validated!)
|
||||||
|
(-> (core/generate (config-from-document) (auth-from-document))
|
||||||
|
(set-output!)))))
|
||||||
|
(-> (config)
|
||||||
|
(.addEventListener "blur"
|
||||||
|
#(do (validate-config!)
|
||||||
|
(validate-auth!)
|
||||||
|
(set-validated!))))
|
||||||
|
(-> (auth)
|
||||||
|
(.addEventListener "blur"
|
||||||
|
#(do (validate-config!)
|
||||||
|
(validate-auth!)
|
||||||
|
(set-validated!)))))
|
24
src/main/cljs/dda/k8s_keycloak/yaml.cljs
Normal file
24
src/main/cljs/dda/k8s_keycloak/yaml.cljs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
(ns dda.k8s-keycloak.yaml
|
||||||
|
(:require
|
||||||
|
["js-yaml" :as yaml]
|
||||||
|
[shadow.resource :as rc]
|
||||||
|
))
|
||||||
|
|
||||||
|
(def config (rc/inline "config.yaml"))
|
||||||
|
|
||||||
|
(def cron (rc/inline "cron.yaml"))
|
||||||
|
|
||||||
|
(def deployment (rc/inline "deployment.yaml"))
|
||||||
|
|
||||||
|
(defn load-resource [resource-name]
|
||||||
|
(case resource-name
|
||||||
|
"config.yaml" config
|
||||||
|
"cron.yaml" cron
|
||||||
|
"deployment.yaml" deployment))
|
||||||
|
|
||||||
|
(defn from-string [input]
|
||||||
|
(js->clj (yaml/load input)
|
||||||
|
:keywordize-keys true))
|
||||||
|
|
||||||
|
(defn to-string [edn]
|
||||||
|
(yaml/dump (clj->js edn)))
|
11
src/main/resources/config.yaml
Executable file
11
src/main/resources/config.yaml
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: keycloak
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: k8s-keycloak
|
||||||
|
data:
|
||||||
|
config.edn: |
|
||||||
|
some-config-value
|
||||||
|
credentials.edn: |
|
||||||
|
some-credentials-value
|
36
src/main/resources/cron.yaml
Normal file
36
src/main/resources/cron.yaml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: keycloak-cron
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: k8s-keycloak
|
||||||
|
spec:
|
||||||
|
schedule: "* */15 * * *"
|
||||||
|
successfulJobsHistoryLimit: 5
|
||||||
|
failedJobsHistoryLimit: 5
|
||||||
|
concurrencyPolicy: Replace
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: keycloak
|
||||||
|
containers:
|
||||||
|
- image: domaindrivenarchitecture/keycloak
|
||||||
|
name: keycloak
|
||||||
|
env:
|
||||||
|
- name: MASTODON_BOT_CREDENTIALS
|
||||||
|
value: /credentials.edn
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /config.edn
|
||||||
|
subPath: config.edn
|
||||||
|
readOnly: true
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /credentials.edn
|
||||||
|
subPath: credentials.edn
|
||||||
|
readOnly: true
|
||||||
|
restartPolicy: Never
|
||||||
|
|
35
src/main/resources/deployment.yaml
Normal file
35
src/main/resources/deployment.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: k8s-keycloak
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: k8s-keycloak
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: k8s-keycloak
|
||||||
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: keycloak
|
||||||
|
containers:
|
||||||
|
- image: domaindrivenarchitecture/keycloak
|
||||||
|
name: keycloak
|
||||||
|
env:
|
||||||
|
- name: MASTODON_BOT_CREDENTIALS
|
||||||
|
value: /credentials.edn
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /config.edn
|
||||||
|
subPath: config.edn
|
||||||
|
readOnly: true
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /credentials.edn
|
||||||
|
subPath: credentials.edn
|
||||||
|
readOnly: true
|
||||||
|
|
50
src/main/resources/logback.xml
Normal file
50
src/main/resources/logback.xml
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<configuration scan="true" scanPeriod="1 seconds" debug="false">
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<level>INFO</level>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="PALLETFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>logs/pallet.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>logs/old/pallet.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<maxHistory>3</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%date %level [%thread] %logger{10} %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="clj-ssh.ssh" level="ERROR">
|
||||||
|
<appender-ref ref="PALLETFILE" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="pallet" level="DEBUG">
|
||||||
|
<appender-ref ref="PALLETFILE" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="pallet.ssh" level="ERROR">
|
||||||
|
<appender-ref ref="PALLETFILE" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="pallet.algo" level="ERROR">
|
||||||
|
<appender-ref ref="PALLETFILE" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="dda" level="DEBUG">
|
||||||
|
<appender-ref ref="PALLETFILE" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="meissa" level="DEBUG">
|
||||||
|
<appender-ref ref="PALLETFILE" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root level="DEBUG">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
13
src/test/cljc/dda/k8s_keycloak/core_test.cljc
Normal file
13
src/test/cljc/dda/k8s_keycloak/core_test.cljc
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
(ns dda.k8s-keycloak.core-test
|
||||||
|
(:require
|
||||||
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
|
[dda.k8s-keycloak.core :as cut]))
|
||||||
|
|
||||||
|
(deftest should-generate-yaml
|
||||||
|
(is (= {:apiVersion "v1", :kind "ConfigMap"
|
||||||
|
:metadata {:name "keycloak",
|
||||||
|
:labels {:app.kubernetes.io/name "k8s-keycloak"}},
|
||||||
|
:data {:config.edn "some-config-value\n",
|
||||||
|
:credentials.edn "some-credentials-value\n"}}
|
||||||
|
(cut/generate-config "some-config-value\n" "some-credentials-value\n"))))
|
22
src/test/cljc/dda/k8s_keycloak/yaml_test.cljc
Normal file
22
src/test/cljc/dda/k8s_keycloak/yaml_test.cljc
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
(ns dda.k8s-keycloak.yaml-test
|
||||||
|
(:require
|
||||||
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
|
[dda.k8s-keycloak.yaml :as cut]))
|
||||||
|
|
||||||
|
(deftest should-parse-yaml-string
|
||||||
|
(is (= {:hallo "welt"}
|
||||||
|
(cut/from-string "hallo: welt"))))
|
||||||
|
|
||||||
|
(deftest should-generate-yaml-string
|
||||||
|
(is (= "hallo: welt
|
||||||
|
"
|
||||||
|
(cut/to-string {:hallo "welt"}))))
|
||||||
|
|
||||||
|
(deftest should-convert-config-yml-to-map
|
||||||
|
(is (= {:apiVersion "v1", :kind "ConfigMap"
|
||||||
|
:metadata {:name "keycloak",
|
||||||
|
:labels {:app.kubernetes.io/name "k8s-keycloak"}},
|
||||||
|
:data {:config.edn "some-config-value\n",
|
||||||
|
:credentials.edn "some-credentials-value\n"}}
|
||||||
|
(cut/from-string (cut/load-resource "config.yaml")))))
|
1
src/test/resources/invalid-auth.edn
Normal file
1
src/test/resources/invalid-auth.edn
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{:xx {}}
|
27
src/test/resources/invalid-config.edn
Normal file
27
src/test/resources/invalid-config.edn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{:transform [{:source {:source-type :twitter
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-replies? false
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-rts? false
|
||||||
|
;; Replace Twitter links by Nitter
|
||||||
|
:nitter-urls? 42
|
||||||
|
;; accounts you wish to mirror
|
||||||
|
:accounts ["arstechnica" "WIRED"]}
|
||||||
|
:target {:target-type :mastodon
|
||||||
|
;; optional flag specifying wether the name of the account
|
||||||
|
;; will be appended in the post, defaults to false
|
||||||
|
:append-screen-name? false
|
||||||
|
;; optional visibility flag: direct, private, unlisted, public
|
||||||
|
;; defaults to public
|
||||||
|
:visibility "unlisted"
|
||||||
|
;; optional boolean to mark content as sensitive. Defaults to true.
|
||||||
|
:sensitive? true
|
||||||
|
;; optional boolean defaults to false
|
||||||
|
;; only sources containing media will be posted when set to true
|
||||||
|
:media-only? true
|
||||||
|
;; optional limit for the post length. Defaults to 300.
|
||||||
|
:max-post-length 300
|
||||||
|
;; optional signature for posts. Defaults to "not present".
|
||||||
|
:signature "#newsbot"}
|
||||||
|
}]
|
||||||
|
:auth {}}
|
1
src/test/resources/valid-auth.edn
Normal file
1
src/test/resources/valid-auth.edn
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{:auth {}}
|
27
src/test/resources/valid-config.edn
Normal file
27
src/test/resources/valid-config.edn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{:transform [{:source {:source-type :twitter
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-replies? false
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-rts? false
|
||||||
|
;; Replace Twitter links by Nitter
|
||||||
|
:nitter-urls? false
|
||||||
|
;; accounts you wish to mirror
|
||||||
|
:accounts ["arstechnica" "WIRED"]}
|
||||||
|
:target {:target-type :mastodon
|
||||||
|
;; optional flag specifying wether the name of the account
|
||||||
|
;; will be appended in the post, defaults to false
|
||||||
|
:append-screen-name? false
|
||||||
|
;; optional visibility flag: direct, private, unlisted, public
|
||||||
|
;; defaults to public
|
||||||
|
:visibility "unlisted"
|
||||||
|
;; optional boolean to mark content as sensitive. Defaults to true.
|
||||||
|
:sensitive? true
|
||||||
|
;; optional boolean defaults to false
|
||||||
|
;; only sources containing media will be posted when set to true
|
||||||
|
:media-only? true
|
||||||
|
;; optional limit for the post length. Defaults to 300.
|
||||||
|
:max-post-length 300
|
||||||
|
;; optional signature for posts. Defaults to "not present".
|
||||||
|
:signature "#newsbot"}
|
||||||
|
}]
|
||||||
|
:auth {}}
|
Loading…
Reference in a new issue