Stuff I'm Up To

Technical Ramblings

Laravel and Firebase Sync — September 30, 2019

Laravel and Firebase Sync

Today I’ve been working on an idea I’ve had for a while now. Sometimes you want your internal data exposed to the outside world, but don’t really want to open any firewall rules or create a reverse proxy etc.

Typically this could be used for a mobile application or forms product to access data that is created internally, but external users need to use it for form lookups or choices driven by your live system.

For this I looked at synchronising a table with Google Firebase cloud service.

Continue reading
Developing in Windows — September 25, 2019

Developing in Windows

Surely not! Whoever would want to develop software using Windows?

Well over the past week or so I’ve been taking a look at how things would look if I were to develop using Windows as the OS.

There are a few challenges. One of them relating to CRLF vs LF, but there are also a few other issues that add complexity.

For instance, using Nginx and redis server on Windows, isn’t as simple as grabbing them from the apt repository and installing them so they start as a service. Both of these are a little clunky when it comes to setting them up as Windows services, not impossible, but certainly not point and click.

Then what about using different versions of PHP depending upon the project you are working on? Pretty straight forward on Linux, but frustrating on Windows.

That was until I came across Laragon.

Laragon bundles a load of services and programs into a convenient wrapper so you can easily chop and change your development platform to suit your project.

Laragon includes services for web servers, both Apache and Nginx – including SSL/HTTPS support. It includes redis server. Includes the ability to swap PHP versions, run Node.js and provision databases using MySQL.

TailBlazer —
Git Credentials — September 18, 2019

Git Credentials

Using git to push commits up to the remote is all in a days work. The change happens when you switch to a new remote and use a new account.

My first actions where to change the remote for my local project. This is easy enough using git remote set-url origin [url]. It was only when I went to push this project up to the new remote repository that I found I was being denied with a 403 error, which means permission denied.

The big reason for the problem was a change from ssh to https. Using ssh was pretty straight forward, as long as you have your key and it is registered in your .gitconfig for the host your pushing to the credentials are pretty robust.

I’d take a step toward running the remotes on https due to firewall and proxy issues that meant https should be easier.

But because ssh keys can make life easier by not having a key password (cool, unless your user password is weak), the change to https means you need to provide credentials on each push.

This is where you need to start looking at Git Credentials Storage.

Under Linux you can specify a credentials file that will feed your details into the process. The file should be placed somewhere every secure and with the correct permissions to ensure it isn’t misused. For instance as a hidden file under your home directory with nly you having permission to access it.

eg.

$ touch  ~/.my-credentials
£ chmod 600 ~/.my-credentials
$ git config credential.helper 'store --file ~/.my-credentials'

But with Windows things actually get a bit easier! Which is hard for a Linux head to accept :)

The git helper for Windows means that your credentials get stored with your windows account.

$  git config credential.helper manager

Because I changed remotes and changed the account I was using, under Windows I needed to remove my old credentials. This is easy enough. I just brought up the start menu and type “credentials“. Then I chose the option for “Manage Windows Credentials“. In the list of generic credentials I could see my old account and simply removed it. The next time I pushed I was asked for new credentials which then got added into the list for me.

VSCode CRLF vs LF Battle — September 4, 2019

VSCode CRLF vs LF Battle

I’m a Linux guy. I like my line feeds a simple LF. but when developing cross platform and you hit Windows and face CRLF. It can be a real linting challenge.

Git tries to be helpful in that it translates LF to CRLF when you pull onto a windows platform. But that doesn’t help at all when your projects .eslintrc.js is set for unix type line endings.

      "linebreak-style": [
        "error",
        "unix"
      ], 

Changing CRLF to LF in VSCode is easy enough, but having to do it on every file you open is madness.

Continue reading
Laravel and O365 Authentication —

Laravel and O365 Authentication

Our app currently uses LDAP authentication but as our environment is rapidly moving onto the cloud and Microsoft Office 365 it’s time to investigate authentication using O365, more specifically Azure Active Directory.

Getting this going was actually more straight forward than I expected. Laravel already has an authentication provider for OAuth2 called Socialite. Once installed I needed to add in the ‘microsoft-graph’ driver.

The key piece of the puzzle is here: https://socialiteproviders.netlify.com/providers/microsoft-graph.html

Continue reading