Coder Social home page Coder Social logo

mladen2023 / safe-config-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from safe-global/safe-config-service

0.0 0.0 0.0 1.14 MB

The safe-config-service is a service that provides configuration information in the context of the Safe clients environment

License: MIT License

Shell 0.30% Python 98.75% HTML 0.34% Dockerfile 0.61%

safe-config-service's Introduction

safe-config-service

Coverage Status

The safe-config-service is a service that provides configuration information in the context of the Safe clients environment (eg.: list of available safe apps and chain metadata).

Requirements

Setup

In order to start the server application:

1. Install the required Python dependencies. Eg.: With a python virtual environment:

python -m venv venv # creates a virtual environment venv in the local directory
source venv/bin/activate
pip install -r requirements-dev.txt

2. Launch the Postgres database image

docker compose up -d db

3. Execute pending database migrations

python src/manage.py migrate

4. Create an admin user

The admin interface of the service will be available under http://localhost:8000/admin but you need to have an admin registered before you are able to access the panel.

To create an admin user:

python src/manage.py createsuperuser

5. Launch the service:

python src/manage.py runserver

By default the service will be available under http://127.0.0.1:8000/

Configuration

The service is already configured for development purposes however if you wish to deploy it in a production environment you should set some sensitive parameters such as: POSTGRES_USER , POSTGRES_PASSWORD, SECRET_KEY. DEBUG should be set to false.

We provide the .dev.env file which explains the role of each environment variable. You can set the configuration using this file and read it in terminal session where the application will be executed.

Testing

Pytest is used to run the available tests in the project. Some of these tests validate the integration with the database so having one running is required. From the project root:

docker compose up -d db
pytest src

Code Style Formatter and Linter

Black, Flake8 and isort are the tools used to validate the style of the changes being pushed. You can refer to the documentation of these tools to check how to integrate them with your editor/IDE.

isort --profile black src # sorts imports according to the isort spec with a profile compatible with Black
black src # formats the files in the src folder using Black
flake8 src # runs flake8 Linter in the src folder

There's also a pre-commit hook that you can install locally via pre-commit so that it formats the files changed on each commit automatically:

pre-commit install # installs commit hook under .git/hooks/pre-commit
git commit # Initially this can take a couple minutes to setup the environment (which will be reused in following commits)

safe-config-service's People

Contributors

dependabot[bot] avatar fmrsabino avatar hectorgomezv avatar iamacook avatar mmv08 avatar uxio0 avatar moisses89 avatar jpalvarezl avatar abhinavmsra avatar inomurko avatar schmanu avatar rmeissner avatar gmonty030 avatar servroxsolutions avatar

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.