<commit_before>{% set minion_id = salt.grains.get('id', '') %}
{% set environment = minion_id.split('-')[-1] %}
{% set rds_endpoint = salt.boto_rds.get_endpoint('production-apps-rds-postgres-mitxpro') %}

{% set env_dict = {
    'ci': {
      'app_name': 'xpro-ci',
      'env_name': 'ci',
      'GOOGLE_TRACKING_ID': 'GTM-KG4FR7J',
      'release_branch': 'master',
      'app_log_level': 'INFO',
      'sentry_log_level': 'ERROR',
      'logout_redirect_url': 'https://courses-ci.xpro.mit.edu/logout',
      'OPENEDX_API_BASE_URL': 'https://courses-ci.xpro.mit.edu',
      'openedx_environment': 'mitxpro-qa',
      'CYBERSOURCE_SECURE_ACCEPTANCE_URL': 'https://testsecureacceptance.cybersource.com/pay',
      'CYBERSOURCE_WSDL_URL': 'https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.154.wsdl',
      'HUBSPOT_FOOTER_FORM_GUID': 'ff810010-c33c-4e99-9285-32d283fbc816',
      'HUBSPOT_ID_PREFIX': 'xpro-ci',
      'HUBSPOT_NEW_COURSES_FORM_GUID': 'b9220dc1-4e48-4097-8539-9f2907f18b1e',
      'HUBSPOT_PORTAL_ID': 5890463,
      'MAILGUN_FROM_EMAIL': 'MIT xPRO <<EMAIL>>',
      'MAILGUN_SENDER_DOMAIN': '<EMAIL>',
      'MITXPRO_BASE_URL': 'https://xpro-ci.odl.mit.edu',
      'vault_env_path': 'rc-apps',
      'VOUCHER_COMPANY_ID': 1
      },
    'rc': {
      'app_name': 'xpro-rc',
      'env_name': 'rc',
      'GOOGLE_TRACKING_ID': 'GTM-KG4FR7J',
      'release_branch': 'release-candidate',
      'app_log_level': 'INFO',
      'sentry_log_level': 'WARN',
      'logout_redirect_url': 'https://courses-rc.xpro.mit.edu/logout',
      'OPENEDX_API_BASE_URL': 'https://courses-rc.xpro.mit.edu',
      'openedx_environment': 'mitxpro-qa',
      'CYBERSOURCE_SECURE_ACCEPTANCE_URL': 'https://testsecureacceptance.cybersource.com/pay',
      'CYBERSOURCE_WSDL_URL': 'https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.154.wsdl',
      'HUBSPOT_FOOTER_FORM_GUID': 'ff810010-c33c-4e99-9285-32d283fbc816',
      'HUBSPOT_ID_PREFIX': 'xpro-rc',
      'HUBSPOT_NEW_COURSES_FORM_GUID': 'b9220dc1-4e48-4097-8539-9f2907f18b1e',
      'HUBSPOT_PORTAL_ID': 5890463,
      'MAILGUN_FROM_EMAIL': 'MIT xPRO <<EMAIL>>',
      'MAILGUN_SENDER_DOMAIN': 'xpro-rc-mail.odl.<EMAIL>.edu',
      'MITXPRO_BASE_URL': 'https://xpro-rc.odl.mit.edu',
      'vault_env_path': 'rc-apps',
      'VOUCHER_COMPANY_ID': 1
      },
    'production': {
      'app_name': 'xpro-production',
      'env_name': 'production',
      'GOOGLE_TRACKING_ID': 'GTM-KG4FR7J',
      'release_branch': 'release',
      'app_log_level': 'INFO',
      'sentry_log_level': 'WARN',
      'logout_redirect_url': 'https://courses.xpro.mit.edu/logout',
      'OPENEDX_API_BASE_URL': 'https://courses.xpro.mit.edu',
      'openedx_environment': 'mitxpro-production',
      'CYBERSOURCE_SECURE_ACCEPTANCE_URL': 'https://secureacceptance.cybersource.com/pay',
      'CYBERSOURCE_WSDL_URL': 'https://ics2wsa.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.154.wsdl',
      'HUBSPOT_FOOTER_FORM_GUID': '6f7e46ec-f757-43a4-b109-597210df0f75',
      'HUBSPOT_ID_PREFIX': 'xpro',
      'HUBSPOT_NEW_COURSES_FORM_GUID': 'ad5d54e5-5ca9-4255-9c17-fa222e0a9b82',
      'HUBSPOT_PORTAL_ID': 4994459,
      'MAILGUN_FROM_EMAIL': 'MIT xPRO <<EMAIL>>',
      'MAILGUN_SENDER_DOMAIN': 'xpro-mail.odl.mit.edu',
      'MITXPRO_BASE_URL': 'https://xpro.mit.edu',
      'vault_env_path': 'production-apps',
      'VOUCHER_COMPANY_ID': 0
      }
} %}
{% set env_data = env_dict[environment] %}
{% set business_unit = 'mitxpro' %}
{% set pg_creds = salt.vault.cached_read('postgres-production-apps-mitxpro/creds/mitxpro', cache_prefix='heroku-mitxpro') %}
{% set cybersource_creds = salt.vault.read('secret-' ~ business_unit ~ '/' ~ env_data.vault_env_path ~ '/cybersource') %}

proxy:
  proxytype: heroku

heroku:
  app_name: {{ env_data.app_name }}
  api_key: __vault__::secret-operations/global/heroku/api_key>data>value
  config_vars:
    AWS_ACCESS_KEY_ID:  __vault__:cache:aws-mitx/creds/read-write-delete-xpro-app-{{ env_data.env_name }}>data>access_key
    AWS_SECRET_ACCESS_KEY: __vault__:cache:aws-mitx/creds/read-write-delete-xpro-app-{{ env_data.env_name }}>data>secret_key
    AWS_STORAGE_BUCKET_NAME: 'xpro-app-{{ env_data.env_name }}'
    CYBERSOURCE_ACCESS_KEY: {{ cybersource_creds.data.access_key }}
    CYBERSOURCE_MERCHANT_ID: 'mit_odl_xpro'
    CYBERSOURCE_PROFILE_ID: {{ cybersource_creds.data.profile_id }}
    CYBERSOURCE_REFERENCE_PREFIX: xpro-{{ env_data.env_name }}
    CYBERSOURCE_SECURE_ACCEPTANCE_URL: {{ env_data.CYBERSOURCE_SECURE_ACCEPTANCE_URL}}
    CYBERSOURCE_SECURITY_KEY: {{ cybersource_creds.data.security_key }}<commit_msg>Fixing voucher company ID for xpro production<commit_after>{% set minion_id = salt.grains.get('id', '') %}
{% set environment = minion_id.split('-')[-1] %}
{% set rds_endpoint = salt.boto_rds.get_endpoint('production-apps-rds-postgres-mitxpro') %}

{% set env_dict = {
    'ci': {
      'app_name': 'xpro-ci',
      'env_name': 'ci',
      'GOOGLE_TRACKING_ID': 'GTM-KG4FR7J',
      'release_branch': 'master',
      'app_log_level': 'INFO',
      'sentry_log_level': 'ERROR',
      'logout_redirect_url': 'https://courses-ci.xpro.mit.edu/logout',
      'OPENEDX_API_BASE_URL': 'https://courses-ci.xpro.mit.edu',
      'openedx_environment': 'mitxpro-qa',
      'CYBERSOURCE_SECURE_ACCEPTANCE_URL': 'https://testsecureacceptance.cybersource.com/pay',
      'CYBERSOURCE_WSDL_URL': 'https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.154.wsdl',
      'HUBSPOT_FOOTER_FORM_GUID': 'ff810010-c33c-4e99-9285-32d283fbc816',
      'HUBSPOT_ID_PREFIX': 'xpro-ci',
      'HUBSPOT_NEW_COURSES_FORM_GUID': 'b9220dc1-4e48-4097-8539-9f2907f18b1e',
      'HUBSPOT_PORTAL_ID': 5890463,
      'MAILGUN_FROM_EMAIL': 'MIT xPRO <<EMAIL>>',
      'MAILGUN_SENDER_DOMAIN': 'xpro-ci-mail.odl.mit.edu',
      'MITXPRO_BASE_URL': 'https://xpro-ci.odl.mit.edu',
      'vault_env_path': 'rc-apps',
      'VOUCHER_COMPANY_ID': 1
      },
    'rc': {
      'app_name': 'xpro-rc',
      'env_name': 'rc',
      'GOOGLE_TRACKING_ID': 'GTM-KG4FR7J',
      'release_branch': 'release-candidate',
      'app_log_level': 'INFO',
      'sentry_log_level': 'WARN',
      'logout_redirect_url': 'https://courses-rc.xpro.mit.edu/logout',
      'OPENEDX_API_BASE_URL': 'https://courses-rc.xpro.mit.edu',
      'openedx_environment': 'mitxpro-qa',
      'CYBERSOURCE_SECURE_ACCEPTANCE_URL': 'https://testsecureacceptance.cybersource.com/pay',
      'CYBERSOURCE_WSDL_URL': 'https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.154.wsdl',
      'HUBSPOT_FOOTER_FORM_GUID': 'ff810010-c33c-4e99-9285-32d283fbc816',
      'HUBSPOT_ID_PREFIX': 'xpro-rc',
      'HUBSPOT_NEW_COURSES_FORM_GUID': 'b9220dc1-4e48-4097-8539-9f2907f18b1e',
      'HUBSPOT_PORTAL_ID': 5890463,
      'MAILGUN_FROM_EMAIL': 'MIT xPRO <<EMAIL>>',
      'MAILGUN_SENDER_DOMAIN': 'xpro-rc-mail.odl.mit.edu',
      'MITXPRO_BASE_URL': 'https://xpro-rc.odl.mit.edu',
      'vault_env_path': 'rc-apps',
      'VOUCHER_COMPANY_ID': 1
      },
    'production': {
      'app_name': 'xpro-production',
      'env_name': 'production',
      'GOOGLE_TRACKING_ID': 'GTM-KG4FR7J',
      'release_branch': 'release',
      'app_log_level': 'INFO',
      'sentry_log_level': 'WARN',
      'logout_redirect_url': 'https://courses.xpro.mit.edu/logout',
      'OPENEDX_API_BASE_URL': 'https://courses.xpro.mit.edu',
      'openedx_environment': 'mitxpro-production',
      'CYBERSOURCE_SECURE_ACCEPTANCE_URL': 'https://secureacceptance.cybersource.com/pay',
      'CYBERSOURCE_WSDL_URL': 'https://ics2wsa.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.154.wsdl',
      'HUBSPOT_FOOTER_FORM_GUID': '6f7e46ec-f757-43a4-b109-597210df0f75',
      'HUBSPOT_ID_PREFIX': 'xpro',
      'HUBSPOT_NEW_COURSES_FORM_GUID': 'ad5d54e5-5ca9-4255-9c17-fa222e0a9b82',
      'HUBSPOT_PORTAL_ID': 4994459,
      'MAILGUN_FROM_EMAIL': 'MIT xPRO <<EMAIL>>',
      'MAILGUN_SENDER_DOMAIN': 'xpro-mail.odl.mit.edu',
      'MITXPRO_BASE_URL': 'https://xpro.mit.edu',
      'vault_env_path': 'production-apps',
      'VOUCHER_COMPANY_ID': 4
      }
} %}
{% set env_data = env_dict[environment] %}
{% set business_unit = 'mitxpro' %}
{% set pg_creds = salt.vault.cached_read('postgres-production-apps-mitxpro/creds/mitxpro', cache_prefix='heroku-mitxpro') %}
{% set cybersource_creds = salt.vault.read('secret-' ~ business_unit ~ '/' ~ env_data.vault_env_path ~ '/cybersource') %}

proxy:
  proxytype: heroku

heroku:
  app_name: {{ env_data.app_name }}
  api_key: __vault__::secret-operations/global/heroku/api_key>data>value
  config_vars:
    AWS_ACCESS_KEY_ID:  __vault__:cache:aws-mitx/creds/read-write-delete-xpro-app-{{ env_data.env_name }}>data>access_key
    AWS_SECRET_ACCESS_KEY: __vault__:cache:aws-mitx/creds/read-write-delete-xpro-app-{{ env_data.env_name }}>data>secret_key
    AWS_STORAGE_BUCKET_NAME: 'xpro-app-{{ env_data.env_name }}'
    CYBERSOURCE_ACCESS_KEY: {{ cybersource_creds.data.access_key }}
    CYBERSOURCE_MERCHANT_ID: 'mit_odl_xpro'
    CYBERSOURCE_PROFILE_ID: {{ cybersource_creds.data.profile_id }}
    CYBERSOURCE_REFERENCE_PREFIX: xpro-{{ env_data.env_name }}
    CYBERSOURCE_SECURE_ACCEPTANCE_URL: {{ env_data.CYBERSOURCE_SECURE_ACCEPTANCE_URL}}
    CYBERSOURCE_SECURITY_KEY: {{ cybersource_creds.data.security_key }}
{'fraction_non_alphanumeric': 0.16059092358380275, 'fraction_numerical': 0.03996173876076097, 'mean_word_length': 4.286516853932584, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 29, 'https://': 30, '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': '883794', 'n_tokens_mistral': 4141, 'n_tokens_neox': 3946, 'n_words': 386}