blob: 81f39571ca996e958fc2cabb958a5e9052a04eb1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env -S perl -w
use warnings;
use strict;
# Get environment variables from .env file
print "The .env-prod file is critical for the deployment.\n";
print ".env file exists in the project directory.\n" if -e "../.env";
print "It contains the following environment variables:\n\n";
my $live_db_url;
my $commented_db_url;
open my $envf, "<", "../.env" or die "Cannot open .env file: $!";
while ( my $line = <$envf>) {
# TODO fix this regex - it will omit commented lines to start with
if ($line =~ /^[A-Z_]+=/) {
if ($line =~ /^DATABASE_URL/) {
my @live_url = split(/=/, $line);
$live_db_url = $live_url[1];
}
if ($line =~ /^#DATABASE_URL/) {
my @commented_url = split(/=/, $line);
$commented_db_url = $commented_url[1];
}
print $line;
}
}
print "\n\nDATABASE_URL is $live_db_url";
print "\n\nCommented DATABASE_URL is $commented_db_url" if defined;
close($envf);
|