Giter VIP home page Giter VIP logo

cloudenvironment's Introduction

Kitura

A Swift Web Framework and HTTP Server

Docs Build Status - Master macOS Linux Apache 2 codecov codebeat badge Slack Status

Summary

Kitura is a web framework and web server that is created for web services written in Swift. For more information, visit www.kitura.dev.

Table of Contents

Features

  • URL routing (e.g., GET, POST, PUT, DELETE, PATCH)
  • Codable routing
  • URL parameters
  • Static file serving
  • FastCGI support
  • SSL/TLS support
  • Pluggable middleware

Getting Started

Visit https://www.kitura.dev for a Getting Started guide, tutorials, and API reference documentation.

Contributing to Kitura

All improvements to Kitura are very welcome! Here's how to get started with developing Kitura itself.

  1. Clone this repository.

$ git clone https://github.com/Kitura/Kitura

  1. Build and run tests.

$ swift test

You can find more info on contributing to Kitura in our contributing guidelines.

Notes

  • Swift-NIO is now the default network engine via the Kitura-NIO package. If for some reason you require the old Kitura-net package, you can still enable it by setting an environment variable KITURA_NIO=0 during build.
  • Most Kitura packages have been updated to require at least Swift 5.2 in order to maintain backward compatibility.

Community

We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!

cloudenvironment's People

Contributors

andrew-lees11 avatar dannys42 avatar djones6 avatar enriquel8 avatar helenmasters avatar ianpartridge avatar mbarnach avatar rfdickerson avatar rob-deans avatar rolivieri avatar sandmman avatar seabaylea avatar shihabmehboob avatar tfrank64 avatar youming-lin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudenvironment's Issues

Allow obtaining a service without specifying its name.

In other words, instead of:

if let psqlService = ConfigurationManager.getPostgreSQLService("MyPostgreSQLService") {}

You can simply do:

if let psqlService = ConfigurationManager.getPostgreSQLService() {}

The rationale is that the majority of projects will only have a single database of that given type in the application that has been configured. So we should have this option available to them.

CloudEnvironment.Credentials is incompatible with Kitura-Credentials (or the other way around)

If both modules CoudEnvirnment and Kitura-Credentials (Credentials) is imported, the type Credentials is ambiguous for the compiler. It looks like it's a compiler limitation https://bugs.swift.org/browse/SR-6705 so It may be a good idea to address the issue on the source level. Since CloudEnvironment is often used with the Kitura framework, it may be a good idea to clarify the Credentials type.

Kitura-Credentials report: Kitura/Kitura-Credentials#36

import CloudEnvironment
import Credentials

public class App {
    let credentials: Credentials.Credentials
}
Application.swift:18:22: error: 'Credentials' is ambiguous for type lookup in this context
    var credentials: Credentials.Credentials
                     ^~~~~~~~~~~
CloudEnvironment.Credentials:4:14: note: found this candidate
public class Credentials {
             ^
Credentials.Credentials:2:14: note: found this candidate
public class Credentials : RouterMiddleware {
             ^

Hardcoded "Bluemix" URLs

In some places, bluemix.net is hardcoded. At the minimum, this must be upgraded to cloud.ibm.com, if not removed entirely.

PushSDKCredentials.swift - CloudEnvironment can be used on other cloud providers (esp given OpenShift will be coming…) but in this code I see “bluemix.net” hardcoded - is that supposed to be there?

   guard let host = url.host,
     host.hasSuffix(“.bluemix.net”)
   else{
     return nil
   }
   let parts = host.split(separator: “.”).suffix(3)
   guard parts.count > 2 && parts.first != “imfpush” else {
     return nil
   }
   return parts.joined(separator: “.”)
 }```

CloudConfiguration 2.x is not compatible with Swift 3.0.2

It would be nice if CloudConfiguration maintained some level of back-compatibility with Swift. For example, Kitura 1.7 works with Swift 3.0.2 and Swift 3.1.1.

Currently I am seeing the following error when compiling my project on Swift 3.0.2 when using CloudConfiguration 2.x:

/tmp/041ffec28bc23291ae0b059c3a2123aa393d3991/swiftserver/Packages/CloudFoundryEnv-4.0.2/Sources/CloudFoundryEnv/AppEnv.swift:184:23: error: use of unresolved identifier 'NSRegularExpression'
      let regex = try NSRegularExpression(pattern: spec, options: NSRegularExpression.Options.caseInsensitive)
                      ^~~~~~~~~~~~~~~~~~~
Foundation.RegularExpression:1:12: note: did you mean 'RegularExpression'?
open class RegularExpression : Foundation.NSObject, NSCopying, NSCoding {
           ^
/tmp/041ffec28bc23291ae0b059c3a2123aa393d3991/swiftserver/Packages/CloudFoundryEnv-4.0.2/Sources/CloudFoundryEnv/AppEnv.swift:184:67: error: use of unresolved identifier 'NSRegularExpression'
      let regex = try NSRegularExpression(pattern: spec, options: NSRegularExpression.Options.caseInsensitive)
                                                                  ^~~~~~~~~~~~~~~~~~~
Foundation.RegularExpression:1:12: note: did you mean 'RegularExpression'?
open class RegularExpression : Foundation.NSObject, NSCopying, NSCoding {
           ^
<unknown>:0: error: build had 1 command failures

Support finding configuration information from other platforms or config structures

Right now, CloudConfiguration relies very heavily on the conventions of VCAP_SERVICES. We should allow the configuration information to come from not only a path inside VCAP_SERVICES, and instead multiple paths that could be compatible with other platforms like Heroku, Amazon AWS, and our Docker deployment.

In other words, we should should support loading files with data that has been the result of something like this:

cf env MyApp > config.json

But often times, the user will want something even easier, especially the Docker case:

Some examples:

I think that a typical config.yml used for a Docker deployment could look like:

- port: 8080
- services:
    - postgresql
        - username: robert
        - password: pa55w0rd
        - hostname: postgresql.bluemix.net 

Add AppID

  • Add AppID to CloudConfiguration
  • Add AppID partial to the generator-swiftserver
  • Add AppID partial to generator-web

Allow for a default load order as a convention

Configuration allows for a very rich way to specify multiple sources for configuration information with priority ordering. However, for many applications, a convention that does the equivalent of:

let config = ConfigurationManager
                                 .load(file: "config.json")
                                 .load(.environmentFiles)
                                 .load(.commandLineArguments)

So that the user simply has to do:

let config = ConfigurationManager.default()

Redis returns Int instead of Int32

Kitura-Redis expects Int32 for the port and as a result using the service and getting the port from it causes a compilation error:

redis?.connect(host: redisService.host, port: redisService.port) { (redisError: NSError?) in

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.