Skip to content

Module to extract information about the OpenShift instance your Ceylon program is running on

License

Notifications You must be signed in to change notification settings

ceylon/ceylon.openshift

Repository files navigation

Ceylon module for running on OpenShift.

Contains information about the running instance of OpenShift.

Usage

To import this module in your Ceylon module descriptor:

import ceylon.openshift "1.3.3";

To turn your module org.foo/2 into an OpenShift application, you can also install the CLI plugin we ship:

$ ceylon plugin install ceylon.openshift/1.3.3

And then in your application run:

$ ceylon openshift init org.foo/2

This will create the appropriate .openshift folder required by the Ceylon OpenShift cartridge, and from there you can start your OpenShift application written in Ceylon.

Example

shared void run() {
    if(openshift.running){
        String url = openshift.postgres.jdbcUrl;
        print("Connecting to postgres at ``url``");
        setupDatabase(url, openshift.postgres.user, openshift.postgres.password, `package fr.devoxx2015.model`);
    }else{
        setupDatabase("jdbc:postgresql://localhost/devoxx2015", 
            "devoxx2015", "devoxx2015", `package fr.devoxx2015.model`);
    }
    Config conf;
    if(openshift.running){
        conf = Config{
            hostName = openshift.ip; 
            port = openshift.port;
            externalHostName = openshift.dns; 
            externalPort = 80;
            applicationPath = openshift.repository;
        };
    }else{
        conf = Config{port = 9001;};
    }
    Application(`package fr.devoxx2015.controller`, conf).start();
}

About

Module to extract information about the OpenShift instance your Ceylon program is running on

Resources

License

Stars

Watchers

Forks

Packages

No packages published