<commit_before>### About
Experiment using Git as a data store to collect users emails for startups 
during product development when not yet public beta is available. 

For serious data driven backend this approach is not suitable, but for small set of data it should work fine.

A few advantages or key features:
- Git repository can be integrated with Slack or Hipchat to receive notifications every time the user signs up
- Use Github or Bitbucket as the data storage, so no need to take care of data replication and data loss yourself

### Architecture (pen and paper)

![Architecture](architecture.jpg)

### Available environment variables
<table>
    <tr>
        <th>Name (default value)</th>
        <th>Purpose</th>
        <th>Possible values</th>
    </tr>
    <tr>
        <td>MARKETING_PORT (3000)</td>
        <td>Port on which the application is running</td>
        <td>Any available port. As application is supposed to be run in Docker container, default value is a good one.</td>
    </tr>
    <tr>
        <td>MARKETING_HOST (localhost)</td>
        <td>Host Jetty binds to</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>MARKETING_REPO_URL</td>
        <td>*Required*. Repository URL to be used to store emails.txt. Will clone the repository, and push changes there.</td>
        <td>Existing URL on Github or Bitbucket using SSH protocol.</td>
    </tr>
    <tr>
        <td>MARKETING_WEB_FLUSH_COMMAND (flush)</td>
        <td>REST endpoint to flush the data manually into emails.txt</td>
        <td>Any REST endpoint of your choice without slash</td>
    </tr>
    <tr>
        <td>MARKETING_WEB_FLUSH_COMMAND_ENABLED (1)</td>
        <td>Whether flush command defined above is enabled</td>
        <td>1 | 0. 0 - to disable flush the data in memory manually from REST</td>
    </tr>
    <tr>
        <td>MARKETING_FLUSH_INTERVAL_MINS (10)</td>
        <td>How often flush the data in memory into file</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>MARKETING_FLUSH_THRESHOLD (10000)</td>
        <td>Number of entries/emails in memory before flush into the file</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>MARKETING_FLUSH_DRY_RUN (0)</td>
        <td>Whether push the changes into remote repository or skip this part and just commit locally. Good for testing and developing locally. </td>
        <td>1 | 0. 1 - to enable dry run, so no push will be performed. REPO_URL still must be valid as it will do clone first.</td>
    </tr>
</table>

### Deployment<commit_msg>Correct reference to REPO_URL env variable<commit_after>### About
Experiment using Git as a data store to collect users emails for startups 
during product development when not yet public beta is available. 

For serious data driven backend this approach is not suitable, but for small set of data it should work fine.

A few advantages or key features:
- Git repository can be integrated with Slack or Hipchat to receive notifications every time the user signs up
- Use Github or Bitbucket as the data storage, so no need to take care of data replication and data loss yourself

### Architecture (pen and paper)

![Architecture](architecture.jpg)

### Available environment variables
<table>
    <tr>
        <th>Name (default value)</th>
        <th>Purpose</th>
        <th>Possible values</th>
    </tr>
    <tr>
        <td>MARKETING_PORT (3000)</td>
        <td>Port on which the application is running</td>
        <td>Any available port. As application is supposed to be run in Docker container, default value is a good one.</td>
    </tr>
    <tr>
        <td>MARKETING_HOST (localhost)</td>
        <td>Host Jetty binds to</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>MARKETING_REPO_URL</td>
        <td>*Required*. Repository URL to be used to store emails.txt. Will clone the repository, and push changes there.</td>
        <td>Existing URL on Github or Bitbucket using SSH protocol.</td>
    </tr>
    <tr>
        <td>MARKETING_WEB_FLUSH_COMMAND (flush)</td>
        <td>REST endpoint to flush the data manually into emails.txt</td>
        <td>Any REST endpoint of your choice without slash</td>
    </tr>
    <tr>
        <td>MARKETING_WEB_FLUSH_COMMAND_ENABLED (1)</td>
        <td>Whether flush command defined above is enabled</td>
        <td>1 | 0. 0 - to disable flush the data in memory manually from REST</td>
    </tr>
    <tr>
        <td>MARKETING_FLUSH_INTERVAL_MINS (10)</td>
        <td>How often flush the data in memory into file</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>MARKETING_FLUSH_THRESHOLD (10000)</td>
        <td>Number of entries/emails in memory before flush into the file</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>MARKETING_FLUSH_DRY_RUN (0)</td>
        <td>Whether push the changes into remote repository or skip this part and just commit locally. Good for testing and developing locally. </td>
        <td>1 | 0. 1 - to enable dry run, so no push will be performed. MARKETING_REPO_URL still must be valid as it will do clone first.</td>
    </tr>
</table>

### Deployment
{'fraction_non_alphanumeric': 0.10229276895943562, 'fraction_numerical': 0.007446600039192632, 'mean_word_length': 2.8260869565217392, 'pattern_counts': {'":': 0, '<': 151, '<?xml version=': 0, '>': 151, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2781127', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1528, 'n_words': 606}