From db67c3df68cfd22fdc683a31873d021b4e540a60 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:33:48 +0000 Subject: [PATCH 1/3] build(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0. - [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index ce83099..b86761a 100644 --- a/go.mod +++ b/go.mod @@ -54,11 +54,11 @@ require ( github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/crypto v0.14.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 673e417..41a0a25 100644 --- a/go.sum +++ b/go.sum @@ -334,8 +334,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -498,13 +498,13 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -515,8 +515,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From a9739c74c496af2d765698c1481c2e1651635a00 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 19 Dec 2023 15:01:24 +0530 Subject: [PATCH 2/3] feat: seperate workflow for PRs Signed-off-by: K.B.Dharun Krishna --- .github/workflows/build-pr.yml | 18 ++++++++++++++++++ .github/workflows/build.yml | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-pr.yml diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 0000000..cf0af4a --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + pull_request: + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set variables + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT" + + - name: Build the Docker image + run: docker build . --file Containerfile --tag vanilla-os/chronos:test diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 028b56d..fe30e07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,6 @@ name: Docker Image CI on: push: branches: [ "main" ] - pull_request: env: REGISTRY_USER: ${{ github.actor }} @@ -25,7 +24,7 @@ jobs: # Push the image to GHCR (Image Registry) - name: Push To GHCR - if: github.repository == 'Vanilla-OS/Chronos' && github.ref == 'refs/heads/main' + if: github.repository == 'Vanilla-OS/Chronos' run: | docker tag vanilla-os/chronos:${{ github.ref_name }} ghcr.io/vanilla-os/chronos:${{ github.ref_name }} docker login ghcr.io -u ${{ env.REGISTRY_USER }} -p ${{ env.REGISTRY_PASSWORD }} From 03d6d1970567e1cab100b37dc02f9d37c2bfee5e Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Tue, 19 Dec 2023 15:07:10 +0530 Subject: [PATCH 3/3] cleanup: fix Markdown syntax and eol Signed-off-by: K.B.Dharun Krishna --- .gitattributes | 1 + README.md | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/README.md b/README.md index 71fb8ed..a01b0ba 100644 --- a/README.md +++ b/README.md @@ -5,38 +5,45 @@
- ## Features + - API based response - Markdown support - Search -- Localized +- Localization - Git based and/or local articles storage - Ristretto based cache (more cache backends coming soon) - Multi-repository support ## Configuration + Edit the `config/chronos.json` file to configure the server. ## Run (dev) + ```bash go run main.go ``` ## Build + ```bash go build -o chronos main.go ``` ## Run (prod) + ```bash ./chronos ``` + ## Repositories + Chronos supports multiple repositories, both local and Git based. This allows you to have a single server for multiple projects or multiple repositories for a single project. Repositories can be configured in the `chronos.json` file as follows: + ```json { "port": "8080", @@ -59,9 +66,11 @@ Each repository must have a unique `id`, Chronos requires it to identify the rep when requesting articles. ### Local repositories + Each local repository must contain an `articles` folder with the following structure: -``` -doumentation + +```txt +documentation ├──articles ├─── en │   └─── article1.md @@ -70,10 +79,12 @@ doumentation ``` ### Git repositories + You can use a Git repositories as well, just add them to the `GitRepos` array in the `chronos.json` file, Chronos will automatically clone them and update on each restart. ### Background updates + In the current version, automatic updates are not supported. ## API Reference @@ -85,6 +96,7 @@ Get the status of the server. - **URL**: `http://localhost:8080/` - **Method**: GET - **Response**: + ```json { "status": "ok" @@ -96,6 +108,7 @@ Check if a repository is available. - **URL**: `http://localhost:8080/{repoId}` - **Method**: GET - **Response**: + ```json { "status": "ok" @@ -109,6 +122,7 @@ Get a list of articles, grouped by language. - **URL**: `http://localhost:8080/{repoId}/articles/{lang}` - **Method**: GET - **Response**: + ```json { "title": "repoId", @@ -143,6 +157,7 @@ Get a list of supported languages. - **URL**: `http://localhost:8080/{repoId}/langs` - **Method**: GET - **Response**: + ```json { "SupportedLang": ["en", "it"] @@ -156,6 +171,7 @@ Get a specific article by providing its language and slug. - **URL**: `http://localhost:8080/{repoId}/articles/en/test` - **Method**: GET - **Response**: + ```json { "Title": "Test Article", @@ -173,6 +189,7 @@ Search articles based on a query string. - **URL**: `http://localhost:8080/{repoId}/search/{lang}?q=test` - **Method**: GET - **Response**: + ```json [ {