feat: setup env for superset BE
parent
dc97d5e14a
commit
cb9421622d
|
@ -41,4 +41,6 @@ ASSETS="https://asset.sky.eigen.co.id/"
|
|||
GOOGLE_CALENDAR_KEY="AIzaSyCSg4P3uC9Z7kD1P4f3rf1BbBaz4Q-M55o"
|
||||
GOOGLE_CALENDAR_ID="326464ac296874c7121825f5ef2e2799baa90b51da240f0045aae22beec10bd5@group.calendar.google.com"
|
||||
|
||||
SUPERSET_URL=https://dashboard.weplayground.eigen.co.id
|
||||
SUPERSET_URL=https://dashboard.weplayground.eigen.co.id
|
||||
SUPERSET_ADMIN_USERNAME=admin
|
||||
SUPERSET_ADMIN_PASSWORD=admin
|
|
@ -38,4 +38,6 @@ ASSETS="https://asset.sky.eigen.co.id/"
|
|||
GOOGLE_CALENDAR_KEY="AIzaSyCSg4P3uC9Z7kD1P4f3rf1BbBaz4Q-M55o"
|
||||
GOOGLE_CALENDAR_ID="326464ac296874c7121825f5ef2e2799baa90b51da240f0045aae22beec10bd5@group.calendar.google.com"
|
||||
|
||||
SUPERSET_URL=https://dashboard.weplayground.eigen.co.id
|
||||
SUPERSET_URL=https://dashboard.weplayground.eigen.co.id
|
||||
SUPERSET_ADMIN_USERNAME=admin
|
||||
SUPERSET_ADMIN_PASSWORD=admin
|
|
@ -4,14 +4,16 @@ import { firstValueFrom } from 'rxjs';
|
|||
|
||||
@Injectable()
|
||||
export class SupersetService {
|
||||
private SUPERSET_URL = process.env.SUPERSET_URL + '/api';
|
||||
private supersetURL = process.env.SUPERSET_URL + '/api';
|
||||
private adminUsername = process.env.SUPERSET_ADMIN_USERNAME;
|
||||
private adminPassword = process.env.SUPERSET_ADMIN_PASSWORD;
|
||||
|
||||
constructor(private readonly httpService: HttpService) {}
|
||||
|
||||
async getLoginToken() {
|
||||
const data = {
|
||||
username: 'admin',
|
||||
password: 'admin',
|
||||
username: this.adminUsername,
|
||||
password: this.adminPassword,
|
||||
provider: 'db',
|
||||
refresh: true,
|
||||
};
|
||||
|
@ -19,7 +21,7 @@ export class SupersetService {
|
|||
const response = await firstValueFrom(
|
||||
this.httpService.request({
|
||||
method: 'POST',
|
||||
url: `${this.SUPERSET_URL}/v1/security/login`,
|
||||
url: `${this.supersetURL}/v1/security/login`,
|
||||
data: data,
|
||||
}),
|
||||
);
|
||||
|
@ -32,7 +34,7 @@ export class SupersetService {
|
|||
const response = await firstValueFrom(
|
||||
this.httpService.request({
|
||||
method: 'GET',
|
||||
url: `${this.SUPERSET_URL}/v1/security/csrf_token/`,
|
||||
url: `${this.supersetURL}/v1/security/csrf_token/`,
|
||||
headers: { Authorization: `Bearer ${loginToken}` },
|
||||
}),
|
||||
);
|
||||
|
@ -53,13 +55,13 @@ export class SupersetService {
|
|||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${loginToken}`,
|
||||
'X-CSRFToken': `${csrfToken}`,
|
||||
Referer: `${this.SUPERSET_URL}/v1/security/guest_token/`,
|
||||
Referer: `${this.supersetURL}/v1/security/guest_token/`,
|
||||
};
|
||||
|
||||
const response = await firstValueFrom(
|
||||
this.httpService.request({
|
||||
method: 'POST',
|
||||
url: `${this.SUPERSET_URL}/v1/security/guest_token/`,
|
||||
url: `${this.supersetURL}/v1/security/guest_token/`,
|
||||
data: data,
|
||||
headers: headers,
|
||||
}),
|
||||
|
|
Loading…
Reference in New Issue