We had three files that were almost identical, and we can use environment variables to specify the differences. Note we're using the `PGUSER` and `PGPASSWORD` variables, since these variables will automatically be used by the PostgreSQL client when we have a blank `username` and `password` keys in the `database.yml` file (which we did until now). The difference between these variables and the `POSTGRES_USER` and `POSTGRES_PASSWORD` variables is that the `PG` variables are used by the client connecting to the database, while the `POSTGRES_` variables are used by the Docker postgresql image when creating the database superuser. For consistency with the code in our github workflows (and everywhere else in the postgres world), we're respecting this double standard. The fact that there are two different names for what's basically the same thing makes the code confusing, though, particularly when running the docker-compose commands, since we get the password from an environment variable but we have to assign two different environment variables with it. So we're accepting both `PGPASSWORD` and `POSTGRES_PASSWORD` variables in the database configuration file. This way, developers using docker-compose can use `POSTGRES_PASSWORD` for everything and it'll work fine. We're also making `PGPASSWORD` default to `POSTGRES_PASSWORD` so we don't get a warning if we only set `POSTGRES_PASSWORD`: ``` WARN[0000] The "PGPASSWORD" variable is not set. Defaulting to a blank string. ``` Also note we're using `DB_HOST` instead of `PGHOST` because that's the variable Rails currently uses by default for new applications [1]. Finally, note we're using `.presence` in the `ENV` calls in the database.yml file. The `PGPASSWORD` variable was set to an empty string when running docker-compose, so using `ENV["PGPASSWORD"] ||` wouldn't work. [1] https://github.com/rails/rails/blob/c90a8701e5/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt#L22
CONSUL DEMOCRACY
Aplicación de Participación Ciudadana y Gobierno Abierto
Web CONSUL DEMOCRACY Project
Puedes acceder a la página principal del proyecto en http://consuldemocracy.org donde puedes encontrar documentación sobre el uso de la plataforma, videos y enlaces al espacio de la comunidad.
Configuración para desarrollo y tests
NOTA: para unas instrucciones más detalladas, consulta la documentación de instalación local.
Prerrequisitos: tener instalado git, Ruby 3.2.5, CMake, pkg-config, Node.js 18.20.3, ImageMagick y PostgreSQL (9.5 o superior).
Nota: Es posible que ejecutar bin/setup, como se indica a continuación, falle si has configurado un nombre de usuario y contraseña para PostgreSQL. Si es así, edita las líneas que contienen username: y password: (añadiendo tus credenciales) en el fichero config/database.yml y ejecuta bin/setup de nuevo.
git clone https://github.com/consuldemocracy/consuldemocracy.git
cd consuldemocracy
bin/setup
bin/rake db:dev_seed
Para ejecutar la aplicación en local:
bin/rails s
Para ejecutar los tests:
bin/rspec
Nota: ejecutar todos los tests en tu máquina puede tardar más de una hora, por lo que recomendamos encarecidamente que configures un sistema de Integración Continua para ejecutarlos utilizando varios trabajos en paralelo cada vez que abras o modifiques una PR (si usas GitHub Actions o GitLab CI, esto ya está configurado en .github/workflows/tests.yml y .gitlab-ci.yml) y cuando trabajes en tu máquina ejecutes solamente los tests relacionados con tu desarrollo actual. Al configurar la aplicación por primera vez, recomendamos que ejecutes al menos un test en spec/models/ y un test en spec/system/ para comprobar que tu máquina está configurada para ejecutar los tests correctamente.
Puedes usar el usuario administrador por defecto del fichero seeds:
user: admin@consul.dev pass: 12345678
Pero para ciertas acciones, como apoyar, necesitarás un usuario verificado, el fichero seeds proporciona uno:
user: verified@consul.dev pass: 12345678
Licencia
El código de este proyecto está publicado bajo la licencia AFFERO GPL v3 (ver LICENSE-AGPLv3.txt)
Contribuciones
Ver fichero CONTRIBUTING_ES.md
Desarrollo en local con Docker
Puedes leer la guía en https://consul_docs.gitbooks.io/docs/content/es/getting_started/docker.html
