Skip to content

Instantly share code, notes, and snippets.

View mhemrg's full-sized avatar

Mohammad Hossein Ebadollahi mhemrg

View GitHub Profile
<?php
return [
// ...
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
'disks' => [
// ...
@mhemrg
mhemrg / .env
Created December 31, 2018 09:36
FILESYSTEM_CLOUD=liara
LIARA_ENDPOINT="https://asdf.storage.liara.ir"
LIARA_ACCESS_KEY=KBSIYRR36U3A1IO1QARI
LIARA_SECRET_KEY=Z9BV6YsP7jtRQR1qCJk3PWecs22smNTOl7HC1Yj3
LIARA_BUCKET=test
Storage::cloud()->put('hello.text', 'My file contents...');
<?php
use Illuminate\Support\Facades\Storage;
Storage::put('avatars/1', $fileContents);
var Liara = require('@liara/sdk');
var liaraClient = new Liara.Storage.Client({
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
endPoint: '2aoassadfu234.storage.liara.ir',
});
@mhemrg
mhemrg / upload-object.js
Last active January 2, 2019 08:12
Upload an object to Liara Object Storage
liaraClient.putObject('my-files', 'file.txt', 'Hello World!')
.then(() => console.log('File created.'))
@mhemrg
mhemrg / upload-photo.js
Created January 2, 2019 08:13
Upload an stream to Liara Object Storage
const fs = require('fs');
const fileContents = fs.createReadStream('./cat.png');
liaraClient.putObject('photos', '/cat.png', fileContents)
.then(result => console.log('Successfully uploaded.'))
@mhemrg
mhemrg / liara-aws.php
Created January 2, 2019 11:28
Example below shows putObject and getObject operations on Liara using aws-sdk-php. Please replace endpoint,key, secret, Bucket with your local setup in this example.php file. Note that we set use_path_style_endpoint to true to use Liara with AWS SDK for PHP.
<?php
// Include the SDK using the Composer autoloader
date_default_timezone_set('America/Los_Angeles');
require 'vendor/autoload.php';
$s3 = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-east-1',
'endpoint' => 'https://asdfasdf.storage.liara.ir',
@mhemrg
mhemrg / Dockerfile
Created January 25, 2019 20:36
Nodejs + puppeteer + docker
FROM liararepo/node-platform
RUN apt-get update \
# See https://crbug.com/795759
&& apt-get install -yq libgconf-2-4 \
# Install latest chrome dev package, which installs the necessary libs to
# make the bundled version of Chromium that Puppeteer installs work.
&& apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
@mhemrg
mhemrg / Dockerfile
Created January 27, 2019 08:26
Liara - nodejs custom script
FROM liararepo/node-platform
CMD npm run serve