Hide password and host to the database by updating .drone.yaml

remotes/origin/database-api-implementation
Dorian HODIN 2 years ago committed by felixmielcarek
parent 86236ca7c7
commit dda85a0caa

@ -75,3 +75,20 @@ steps:
COMMAND: create
OVERWRITE: true
depends_on: [ php_script ]
#database container
- name: deploy-php-database
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: innodb
CONTAINERNAME: location_php_database
COMMAND: create
PRIVATE: true
CODEFIRST_CLIENTDRONE_ENV_INNONDB_HOST:
from_secret: db_host
CODEFIRST_CLIENTDRONE_ENV_INNODB_DATABASE:
from_secret: db_database
CODEFIRST_CLIENTDRONE_ENV_INNODB_USER:
from_secret: db_user
CODEFIRST_CLIENTDRONE_ENV_INNODB_PASSWORD:
from_secret: db_password

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
@ -7,7 +12,9 @@
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.dart_tool" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpProjectSharedConfiguration" php_language_level="8.1">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
</project>

@ -1,8 +1,8 @@
<?php
$username="dafldev";
$host="89.83.53.34";
$password="wrap";
$db_name="positiondaflmusic";
$username=CODEFIRST_CLIENTDRONE_ENV_INNODB_USER;
$host=CODEFIRST_CLIENTDRONE_ENV_INNONDB_HOST;
$password=CODEFIRST_CLIENTDRONE_ENV_INNODB_PASSWORD;
$db_name=CODEFIRST_CLIENTDRONE_ENV_INNODB_DATABASE;
$connect=mysqli_connect($host,$username,$password,$db_name);
/*

@ -1,7 +1,7 @@
<?php
$dns = 'mysql:host=89.83.53.34;dbname=positiondaflmusic';
$user = 'dafldev';
$password = 'wrap';
$dns = 'mysql:host='.CODEFIRST_CLIENTDRONE_ENV_INNONDB_HOST.';dbname='.CODEFIRST_CLIENTDRONE_ENV_INNODB_DATABASE;
$user = CODEFIRST_CLIENTDRONE_ENV_INNODB_USER;
$password = CODEFIRST_CLIENTDRONE_ENV_INNODB_PASSWORD;
try{
$db = new PDO ($dns, $user, $password);
}catch( PDOException $e){

@ -1,9 +1,6 @@
<?php
class distance
{
public function meters($lat1, $lng1, $lat2, $lng2): float
function meters($lat1, $lng1, $lat2, $lng2): float
{
// Radius of the Earth in meters :
$earth_radius = 6378137;
@ -19,7 +16,6 @@ class distance
// Return the distance in meters between 2 GPS points
return round($earth_radius * $d);
}
}
$db=0;
$connect="";
@ -50,7 +46,7 @@ Foreach ($row as $col) {
$lng2 = $col['longitude'];
$userID = $col['id'];
$idMusic = $col['idMusic'];
$dist = (new distance)->meters($lat1, $lng1, $lat2, $lng2);
$dist = meters($lat1, $lng1, $lat2, $lng2);
if ($dist <= 100) {
$listUser[] = ['user' => $userID, 'music' => $idMusic]; }
}

@ -1,5 +0,0 @@
<?php
echo "Hello world Dafl for PHP"
?>
Loading…
Cancel
Save