Closed rhystmills closed 1 year ago
Code looks great! Lovely to see tests. Tested locally, works as expected – I've made a couple of changes to init-aws.sh to get the paths working that I hope makes sense in 8e06f65.
I think line 9 was sort of right (this one):
awslocal s3 cp /etc/.gu/typerighter/typerighter-dictionary.xml s3://typerighter-app-local/local/dictionary/typerighter-dictionary.xml
... it's copying the file from a location that Docker copies the file to in the localstack container (etc/.gu...
) as specified in the volumes
bit of the docker-compose.yml
- but I've realised the convention is /etc/gu
rather than /etc/.gu
so I'll update that.
I should have remove line 8 because it wasn't doing anything - the localstack container was failing to access composer which led me down the Docker volumes
path. Line 8 was:
aws s3 cp --profile composer --region eu-west-1 s3://typerighter-app-dev/dictionary/typerighter-dictionary.xml ~/.gu/typerighter/typerighter-dictionary.xml
(tested that in CODE and locally - working nicely so merged now)
Ace, thanks @rhystmills! I've a memory that adding config to the user dir ~
is more common now (I can see composer, atom workshop and workflow in there), but unsure if others can confirm, it's totally fine your way too 👍
What does this change?
This PR gives the Rule Manager access to a dictionary XML file from s3, and parses it to a list of unique words.
More specifically, it:
refreshDictionaryRules
endpoint. The list is parsed and converted to a list of unique words - for now this list is only returned to the user - in a follow-up PR we will convert the words to rules in our database.setup-hooks
script with a genericsetup
script that runs ourdev-nginx
setup and pulls the dictionary file for local use.init
script to make the dictionary XML file available in our local S3 instance.How to test
Run the rule manager locally.
Send a POST request to https://manager.typerighter.local.dev-gutools.co.uk/api/refreshDictionary - I use Postman to do this, using auth cookies from the network tab https://manager.typerighter.local.dev-gutools.co.uk/ in the browser (I think this just needs to be
gutoolsAuth-assym
but I tend to includePLAY_SESSION
too).This should return a list of unique words.
~/.gu/typerighter/
if you've already run it)