Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(apps): Set app tokens #179

Merged
merged 21 commits into from
Jun 28, 2023
Merged

chore(apps): Set app tokens #179

merged 21 commits into from
Jun 28, 2023

Conversation

wisley7l
Copy link
Member

No description provided.

@wisley7l
Copy link
Member Author

@leomp12 uma dúvida nesse app do flash courier o contrato poderia ser todo um secret, ou deveriamos salvar cada um como secret aqui ?

const {
login,
password,
hmac,
client_id: clientId,
cct_id: cctIds,
} = contract;

@leomp12
Copy link
Member

leomp12 commented Jun 26, 2023

@leomp12 uma dúvida nesse app do flash courier o contrato poderia ser todo um secret, ou deveriamos salvar cada um como secret aqui ?

É muita coisa né ? 🙃
Acho que é melhor um só mesmo, tipo FLASHCOURIER_CREDENTIALS e ele deve ser salvo como uma string JSON { "password": "", "cct_id": "" ... }

@wisley7l wisley7l changed the title [WIP] chore(apps): Set app tokens chore(apps): Set app tokens Jun 26, 2023
@wisley7l wisley7l requested a review from leomp12 June 27, 2023 00:40
Copy link
Member

@leomp12 leomp12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Só uns typos mesmo porque isso vira API...

action.yml Outdated
galaxpay-hash:
description: 'App: Galax Pay hash'
ga-api-token:
description: 'App: Google analytics API secret'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: 'App: Google analytics API secret'
description: 'App: Google Analytics API secret'

action.yml Outdated
Comment on lines 63 to 66
pagarme-encry-key:
description: 'App: PagarMe Encryption Key'
pagarme-token:
description: 'App: PagarMe API token'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pagarme-encry-key:
description: 'App: PagarMe Encryption Key'
pagarme-token:
description: 'App: PagarMe API token'
pagarme-encrypt-key:
description: 'App: Pagar.me encryption Key'
pagarme-token:
description: 'App: Pagar.me API token'

action.yml Outdated
Comment on lines 73 to 74
webhook-app-token:
description: 'App: Webhooks App Token'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
webhook-app-token:
description: 'App: Webhooks App Token'
webhooks-token:
description: 'App: Webhooks token'

let headers: { Authorization: string; } | undefined;

if (token) {
if (!process.env.WEBHOOKAPP_TOKEN) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!process.env.WEBHOOKAPP_TOKEN) {
if (!process.env.WEBHOOKS_TOKEN) {

if (!process.env.WEBHOOKAPP_TOKEN) {
const webhookAppToken = options.webhook_token
if (typeof webhookAppToken === 'string' && webhookAppToken) {
process.env.WEBHOOKAPP_TOKEN = webhookAppToken;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
process.env.WEBHOOKAPP_TOKEN = webhookAppToken;
process.env.WEBHOOKS_TOKEN = webhookAppToken;

@@ -25,7 +26,25 @@ export default (data: AppModuleBody) => {
...application.hidden_data,
};

if (!configApp.pagarme_encryption_key || !configApp.pagarme_api_key) {
if (!process.env.PAGARME_ENCRYP_KEY) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!process.env.PAGARME_ENCRYP_KEY) {
if (!process.env.PAGARME_ENCRYPT_KEY) {

if (!process.env.PAGARME_ENCRYP_KEY) {
const parameEncrypKey = configApp.pagarme_encryption_key;
if (typeof parameEncrypKey === 'string' && parameEncrypKey) {
process.env.PAGARME_ENCRYP_KEY = parameEncrypKey;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
process.env.PAGARME_ENCRYP_KEY = parameEncrypKey;
process.env.PAGARME_ENCRYPT_KEY = parameEncrypKey;

}
}

if (!process.env.PAGARME_ENCRYP_KEY || !process.env.PAGARME_TOKEN) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!process.env.PAGARME_ENCRYP_KEY || !process.env.PAGARME_TOKEN) {
if (!process.env.PAGARME_ENCRYPT_KEY || !process.env.PAGARME_TOKEN) {

@@ -137,7 +156,7 @@ export default (data: AppModuleBody) => {
// https://github.com/pagarme/pagarme-js
gateway.js_client = {
script_uri: 'https://assets.pagar.me/pagarme-js/4.8/pagarme.min.js',
onload_expression: `window._pagarmeKey="${configApp.pagarme_encryption_key}";
onload_expression: `window._pagarmeKey="${process.env.PAGARME_ENCRYP_KEY}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onload_expression: `window._pagarmeKey="${process.env.PAGARME_ENCRYP_KEY}";
onload_expression: `window._pagarmeKey="${process.env.PAGARME_ENCRYPT_KEY}";

logger.warn('Missing GalaxPay ID');
}
}

const measurementId = appData.measurement_id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não tinha que ter um env opcional pra esse ID também?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quer dizer, só a API key sem esse ID é inútil né?

@wisley7l wisley7l requested a review from leomp12 June 27, 2023 14:55
Copy link
Member

@leomp12 leomp12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valeu 👍🏾

@leomp12 leomp12 merged commit 881530a into main Jun 28, 2023
1 check failed
@leomp12 leomp12 deleted the chore/set-app-tokens branch June 28, 2023 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants