Giter Site home page Giter Site logo

ismogroup / dolirate Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 74 KB

Small tool for automatically update currency rates in Dolibarr

License: GNU Affero General Public License v3.0

Dockerfile 2.42% Shell 10.34% TypeScript 87.24%
apilayer docker dolibarr

dolirate's Introduction

Dolirate

Simple update tool for updating Dolibarr currency rates.

Node 18+ (or 16+ with fetch enable)

You need to define this environment variables.

variable usage default
MYSQL_HOST fqdn of mysql server mysql
MYSQL_PORT port of the mysql server 3306
DOLI_DB_USER the user with access to the Dolibarr database mysql
DOLI_DB_PASSWORD the password associated with the user mysql
DOLI_DB_PREFIX the table prefix llx_
DOLI_DB_NAME the name of the database dolismo
API_LAYER_KEY api key for https://apilayer.com/marketplace/exchangerates_data-api tobefilled

install the required dependencies and build.

npm i && npm run build 

Run the Express server.

node dist/index.cjs

For updating the currency rates visit http://locahost:3000/updaterates with any method

curl http://localhost:3000/updaterates

Command line

Without running an Express server you can run the tool from the command line.
Define the same environment variables:

variable usage default
MYSQL_HOST fqdn of mysql server mysql
MYSQL_PORT port of the mysql server 3306
DOLI_DB_USER the user with access to the Dolibarr database mysql
DOLI_DB_PASSWORD the password associated with the user mysql
DOLI_DB_PREFIX the table prefix llx_
DOLI_DB_NAME the name of the database dolismo
API_LAYER_KEY api key for https://apilayer.com/marketplace/exchangerates_data-api tobefilled

Install and build the app.

npm i && npm run build

Run the tool from the command line.

node dist/cli.cjs

Docker

This is the easiest way.
Create an .env file with the required environment variables and run the image.

docker run -p 3000:3000 --env-file .vscode/env -it dolirate:latest

Full Docker stack

See docker-compose.yml at https://github.com/ismogroup/dolidock for a complete stack with this tool.
A simple cron job is set in crontabui:

/usr/bin/curl http://dolirate:3000/updaterates

dolirate's People

Contributors

eltorio avatar ismogroup avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

arsysnet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.