This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Custom FAB auth manager that adds Azure AD -> Airflow JWT token exchange. | |
| The Airflow 3 REST API only accepts JWTs that Airflow itself issued (via the | |
| auth manager). A service principal holding an Azure AD access token therefore | |
| cannot call the API directly. This auth manager adds a token-exchange path to | |
| ``POST /auth/token``: | |
| POST /auth/token {"azure_token": "<Azure AD access token>"} | |
| -> validate signature (JWKS) + iss + aud + exp/nbf + required app role | |
| -> return the shared service FAB user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import nodemailer from 'nodemailer'; | |
| export class Emailer { | |
| transporter: nodemailer.Transporter; | |
| constructor() { | |
| this.transporter = nodemailer.createTransport({ | |
| host: 'mysmtpserver.com.br', | |
| port: 25 | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ConnectionPool } from 'mssql'; | |
| export class DatabaseClient { | |
| pool: ConnectionPool; | |
| dbConfig: {redated}; | |
| constructor() { | |
| super(); | |
| this.pool = new ConnectionPool(this.dbConfig); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| getUsers$ = (): Observable<any> => { | |
| if (someCondition) { | |
| return from(someAsyncOperation()) | |
| } | |
| else { | |
| return from(someOtherAsyncOperation()) | |
| } | |
| } | |
| getUsers2$ = (): Observable<any> => someCondition ? from(someAsyncOperation()) : from(someOtherAsyncOperation()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| getUsers = async () => new Promise((resolve, reject) => { | |
| if (someCondition) { | |
| someAsyncOperation() | |
| .then((result) => resolve(result)) | |
| .catch((err) => reject(err)) | |
| } | |
| else { | |
| someOtherAsyncOperation() | |
| .then((result) => resolve(result)) | |
| .catch((err) => reject(err)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const users$ = getUsers$(); | |
| users$.pipe( | |
| filter(user => user.isActive), | |
| mergeMap(user => sendEmail$(user.email)) | |
| ).subscribe( | |
| (success) => emailsSent++, | |
| (err) => failedEmails++, | |
| () = > console.log('Emails sent:'+emailsSent+' Emails failed:'+failedEmails) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const EMAIL_PARALLELISM = 5; | |
| const users$ = getUsers$(); | |
| users$.pipe( | |
| filter(user => user.isActive), | |
| mergeMap(user => sendEmail$(user.email), EMAIL_PARALLELISM) | |
| ).subscribe( | |
| (success) => emailsSent++, | |
| (err) => failedEmails++, | |
| () = > console.log('Emails sent:'+emailsSent+' Emails failed:'+failedEmails) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let users$ = from(getUsers()); | |
| users$.pipe( | |
| filter(user => user.isActive), | |
| concatMap(user => from(sendEmail(user.email))) | |
| ).subscribe( | |
| (success) => emailsSent++, | |
| (err) => failedEmails++, | |
| () = > console.log('Emails sent:'+emailsSent+' Emails failed:'+failedEmails) | |
| ) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let someArray = []; | |
| someArray = someOtherArray; | |
| const streamOfItems$ = of(someArray).pipe( | |
| mergeAll() | |
| ) | |
| // streamOfItems$ will emit each item of the array as an observable through the stream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data "http" "access_token" { | |
| url = "https://${var.docker_registry.host}/oauth2/token?service=${var.docker_registry.host}&scope=repository:*:pull" | |
| request_headers = { | |
| Authorization = "Basic ${base64encode("${var.docker_registry.user}:${var.docker_registry.password}")}" | |
| } | |
| } | |
| data "http" "tips-admin" { | |
| url = "https://${var.docker_registry.host}/v2/tips-admin/manifests/${local.environment}" | |
| request_headers = { |
NewerOlder