fix #18 env infos

This commit is contained in:
Baptiste Lemoine 2020-06-11 15:55:05 +02:00
parent edd62826f7
commit cce2319a10
3 changed files with 15 additions and 25 deletions

12
.env
View File

@ -15,10 +15,10 @@
###> symfony/framework-bundle ###
APP_ENV=dev
ADMIN_TOKEN=erfd456ref4ety4h56jy4i5opuoipm564iyuyn312b1s6er78g897ryjt7thsb32d1gfb
APP_SECRET=597b0529ac702d27dcb9089f7e69c362
ADMIN_TOKEN=CHANGE_THIS_STRING_HERE
APP_SECRET=CHANGE_THIS_STRING_THERE
# Base website url, should contain https:// and having no trailing slash. example: BASE_URL=https://framadate.org
BASE_URL=https://framadate-api.cipherbliss.com
BASE_URL=https://YOUR_WEBSITE
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS='^localhost|example\.com$'
###< symfony/framework-bundle ###
@ -28,7 +28,7 @@ BASE_URL=https://framadate-api.cipherbliss.com
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11"
# IMPORTANT: You MUST also configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://root:tiptaoptidou132548@127.0.0.1:5432/symfony
DATABASE_URL=mysql://MYSQL_USER:MYSQL_PASS@127.0.0.1:5432/symfony
###< doctrine/doctrine-bundle ###
###> nelmio/cors-bundle ###
@ -39,9 +39,9 @@ CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=sendmail://framadate-api.cipherbliss.com
MAILER_URL=sendmail://YOUR_WEBSITE
# set the support email who will answer users in case of emergency
SUPPORT_EMAIL=admin_framadate@yopmail.com
SUPPORT_EMAIL=YOUR_EMAIL
###< symfony/swiftmailer-bundle ###
###> symfony/mailer ###

View File

@ -3,9 +3,12 @@ Experimental REST backend in symfony 4 for Funky framadate frontend.
https://framagit.org/framasoft/framadate/funky-framadate-front
Follow this guide to setup.
* run `composer install`
configure env by creating local env file
`cp .env .env.local` and edit the file variables to give access to database.
## TODO:
* coordinate properties and paths to be more restful.
return stack of votes when we want to get the configuration of one poll (see [doc/examples.md](doc/examples.md))

View File

@ -26,7 +26,7 @@ class VoteController extends FramadateController {
/**
* add a vote stack on a poll
* @Post(
* path = "/poll/{id}/vote",
* path = "/poll/{id}/answer",
* name = "new_vote_stack",
* requirements = {"content"="\w+", "poll_id"="\d+"}
* )
@ -119,20 +119,7 @@ class VoteController extends FramadateController {
$this->sendVoteNotificationAction($stack->getOwner(), $stack);
}
$returnedVoteStack = [
'message' => 'you created a vote stack' . $precision,
'poll' => $poll,
'vote_stack' => $stack,
'stacks' => $stacks,
'comments' => $poll->getComments(),
'choices' => $poll->getChoices(),
'choices_count' => $poll->computeAnswers(),
'vote_count' => count( $stacks ),
'owner' => $stack->getOwner(),
'owner_modifier_token' => $stack->getOwner()->getModifierToken(),
'admin_key' => $poll->getAdminKey(),
'json_you_sent' => $data,
];
$returnedVoteStack = $stack;
$jsonResponse = $serializer->serialize($returnedVoteStack, 'json');
@ -219,11 +206,11 @@ class VoteController extends FramadateController {
return $this->json( [
'message' => 'boom! les ' . $length . ' votes du sondage ont été supprimés',
] );
],200 );
} else {
return $this->json( [
'message' => 'le token d\'autorisation est invalide, vous ne pouvez pas modifier ce sondage',
] );
'message' => 'le token d\'autorisation est invalide, vous ne pouvez pas modifier ce sondage'
],403 );
}
}
}